Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
fix: address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
elijaharita committed Nov 8, 2023
1 parent 7e6b818 commit cc43c88
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions blob/local_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ func (l *LocalStore) List(ctx context.Context) ([]ID, error) {
}

for _, binFileEntry := range dir {
if binFileEntry.IsDir() {
// Do not include directories
continue
}

idString, isBin := strings.CutSuffix(binFileEntry.Name(), ".bin")
if !isBin {
// Do not include files that don't end in .bin
Expand Down
5 changes: 2 additions & 3 deletions integration/singularity/id_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"errors"
"fmt"
"os"
"path"
"path/filepath"
"strconv"

Expand All @@ -22,7 +21,7 @@ func newIDMap(dir string) *idMap {
}

func (im *idMap) path(blobID blob.ID) string {
return path.Join(im.dir, blobID.String()+".id")
return filepath.Join(im.dir, blobID.String()+".id")
}

// Inserts a blob ID to Singularity ID mapping.
Expand Down Expand Up @@ -53,7 +52,7 @@ func (im *idMap) insert(blobID blob.ID, singularityID int64) error {
// Maps blob ID to Singularity ID. Returns blob.ErrBlobNotFound if no mapping
// exists.
func (im *idMap) get(blobID blob.ID) (int64, error) {
fileIDString, err := os.ReadFile(filepath.Join(im.dir, blobID.String()+".id"))
fileIDString, err := os.ReadFile(im.path(blobID))
if err != nil {
if errors.Is(err, os.ErrNotExist) {
return 0, blob.ErrBlobNotFound
Expand Down
1 change: 1 addition & 0 deletions integration/singularity/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ func (s *Store) PassGet(w http.ResponseWriter, r *http.Request, id blob.ID) {
return
}

logger.Errorw("Could not get singularity file ID", "err", err)
http.Error(w, "", http.StatusInternalServerError)
return
}
Expand Down

0 comments on commit cc43c88

Please sign in to comment.