Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete thumbnail even if file is not to be deleted #679

Merged
merged 3 commits into from
May 16, 2022

Conversation

lpoli
Copy link
Contributor

@lpoli lpoli commented May 13, 2022

Fixes

Even if there are content sharing refs, they are not supposed to share thumbnail. So if delete operation is called, thumbnail should be deleted regardless

@lpoli lpoli requested a review from peterlimg May 13, 2022 13:40
@codecov-commenter
Copy link

codecov-commenter commented May 13, 2022

Codecov Report

Merging #679 (bb07e01) into staging (89a6ab5) will increase coverage by 0.01%.
The diff coverage is 22.22%.

@@             Coverage Diff             @@
##           staging     #679      +/-   ##
===========================================
+ Coverage    22.00%   22.02%   +0.01%     
===========================================
  Files           69       69              
  Lines         7930     7933       +3     
===========================================
+ Hits          1745     1747       +2     
- Misses        5923     5924       +1     
  Partials       262      262              
Flag Coverage Δ
Unit-Tests 22.02% <22.22%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ain.net/blobbercore/allocation/deletefilechange.go 0.00% <0.00%> (ø)
...ode/go/0chain.net/blobbercore/filestore/storage.go 39.64% <100.00%> (+0.27%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 89a6ab5...bb07e01. Read the comment docs.

@@ -76,7 +81,7 @@ func (nf *DeleteFileChange) CommitToFileStore(ctx context.Context) error {
Where("allocation_id=? AND content_hash=?", nf.AllocationID, res.ContentHash).
Count(&count)

if count != 0 {
if count != 0 && res.ThumbnailHash == "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to use res.ThumbnailSize ==0 instead of res.ThumbnailHash == ""

Copy link
Contributor

@cnlangzi cnlangzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@peterlimg peterlimg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@lpoli lpoli merged commit 8835bb9 into staging May 16, 2022
@lpoli lpoli deleted the fix/thumbnail-deletion branch May 16, 2022 05:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants