Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions pkg/storage/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ func (s *Store) DeleteNarInfo(ctx context.Context, hash string) error {

// HasNar returns true if the store has the nar.
func (s *Store) HasNar(ctx context.Context, narURL nar.URL) bool {
tfp, err := narURL.ToFilePath()
tfp, err := narURL.Normalize().ToFilePath()
if err != nil {
return false
}
Expand All @@ -356,7 +356,10 @@ func (s *Store) HasNar(ctx context.Context, narURL nar.URL) bool {
// GetNar returns nar from the store.
// NOTE: The caller must close the returned io.ReadCloser!
func (s *Store) GetNar(ctx context.Context, narURL nar.URL) (int64, io.ReadCloser, error) {
tfp, err := narURL.ToFilePath()
// Normalize the NAR URL to handle URLs with embedded narinfo hash prefix
normalizedURL := narURL.Normalize()

tfp, err := normalizedURL.ToFilePath()
if err != nil {
return 0, nil, err
}
Expand Down Expand Up @@ -393,7 +396,10 @@ func (s *Store) GetNar(ctx context.Context, narURL nar.URL) (int64, io.ReadClose

// PutNar puts the nar in the store.
func (s *Store) PutNar(ctx context.Context, narURL nar.URL, body io.Reader) (int64, error) {
tfp, err := narURL.ToFilePath()
// Normalize the NAR URL to handle URLs with embedded narinfo hash prefix
normalizedURL := narURL.Normalize()

tfp, err := normalizedURL.ToFilePath()
if err != nil {
return 0, err
}
Expand Down Expand Up @@ -450,7 +456,10 @@ func (s *Store) PutNar(ctx context.Context, narURL nar.URL, body io.Reader) (int

// DeleteNar deletes the nar from the store.
func (s *Store) DeleteNar(ctx context.Context, narURL nar.URL) error {
tfp, err := narURL.ToFilePath()
// Normalize the NAR URL to handle URLs with embedded narinfo hash prefix
normalizedURL := narURL.Normalize()

tfp, err := normalizedURL.ToFilePath()
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ func (s *Store) narInfoPath(hash string) (string, error) {
}

func (s *Store) narPath(narURL nar.URL) (string, error) {
tfp, err := narURL.ToFilePath()
tfp, err := narURL.Normalize().ToFilePath()
if err != nil {
return "", err
}
Expand Down