Skip to content

Commit

Permalink
Fix storage migration
Browse files Browse the repository at this point in the history
  • Loading branch information
andriygm committed Nov 13, 2023
1 parent c360218 commit 917084b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/migrate/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"dvs/internal/git"
"dvs/internal/storage"
"io/fs"
"log"

Check failure on line 8 in internal/migrate/storage.go

View workflow job for this annotation

GitHub Actions / build

"log" imported and not used
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -34,8 +35,10 @@ func migrateStorageFile(storageDir string, path string, dry bool) (match bool, e
return true, nil
}

// Create new directory
newDir := storage.GetStoragePath(storageDir, filepath.Base(path))
fileHash := filepath.Base(path)

// Create new directory for first segment of the filename
newDir := filepath.Join(storageDir, fileHash[:2])
err := os.MkdirAll(newDir, storage.StorageDirPermissions)
if err != nil {
return false, err
Expand Down

0 comments on commit 917084b

Please sign in to comment.