Skip to content

Commit

Permalink
fill in storage provider id if it is missing
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
  • Loading branch information
butonic committed Jul 18, 2022
1 parent caca92f commit 9e68319
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/grpc/services/storageprovider/storageprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,10 @@ func (s *service) InitiateFileDownload(ctx context.Context, req *provider.Initia
protocol := &provider.FileDownloadProtocol{Expose: s.conf.ExposeDataServer}

if utils.IsRelativeReference(req.Ref) {
// fill in storage provider id if it is missing
if req.GetRef().GetResourceId().GetStorageId() == "" {
req.GetRef().GetResourceId().StorageId = s.conf.MountID
}
protocol.Protocol = "spaces"
u.Path = path.Join(u.Path, "spaces", storagespace.FormatResourceID(*req.Ref.ResourceId), req.Ref.Path)
} else {
Expand Down
5 changes: 5 additions & 0 deletions pkg/rhttp/datatx/utils/download/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ func GetOrHeadFile(w http.ResponseWriter, r *http.Request, fs storage.FS, spaceI
return
}

// fill in storage provider id if it is missing
if spaceID != "" && md.GetId().GetStorageId() == "" {
md.Id.StorageId = ref.ResourceId.StorageId
}

var ranges []HTTPRange

if r.Header.Get("Range") != "" {
Expand Down

0 comments on commit 9e68319

Please sign in to comment.