Skip to content

Commit

Permalink
final_fix
Browse files Browse the repository at this point in the history
Signed-off-by: SudhanshuBawane <[email protected]>
  • Loading branch information
SudhanshuBawane committed Feb 27, 2024
1 parent 928fc14 commit 1518782
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 3 additions & 2 deletions asset/boltdb_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,9 @@ func (b *boltDBAssetManager) expandWithDuration(tmpFile *os.File, asset *corev2.
CacheDir := viper.GetString(FlagCacheDir)
fullPath := filepath.Join(CacheDir, assetSHA)

if err := CleanUp(fullPath); err != nil { //fix for git issue 5009
logger.Printf("error cleaning up the SHA dir: %s", err)
if err := CleanUp(fullPath); err != nil {
logger.WithField("assetSHA path", fullPath).WithError(err).
Error("error cleaning up the assetSHA")
}

assetPath = filepath.Join(b.localStorage, asset.Sha512)
Expand Down
3 changes: 1 addition & 2 deletions asset/expander.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ func sniffType(f io.ReadSeeker) (filetype_types.Type, error) {
return ft, nil
}

// Sudhanshu - CleanUp the SHA for the git issue 5009 fix. Making sure that in case of DOS when asset.db gets deleted it gets cleanUp so that asset can be re-downloded

// cleanup of the assetSHA when cache dir gets force deleted
func CleanUp(fullPath string) error {
errorSHA := os.RemoveAll(fullPath)
if errorSHA != nil {
Expand Down

0 comments on commit 1518782

Please sign in to comment.