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 95ef49d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/grpc/services/storageprovider/storageprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,11 @@ func (s *service) InitiateFileDownload(ctx context.Context, req *provider.Initia

protocol := &provider.FileDownloadProtocol{Expose: s.conf.ExposeDataServer}

// fill in storage provider id if it is missing
if req.GetRef().GetResourceId().GetStorageId() == "" {
req.GetRef().GetResourceId().StorageId = s.conf.MountID
}

if utils.IsRelativeReference(req.Ref) {
protocol.Protocol = "spaces"
u.Path = path.Join(u.Path, "spaces", storagespace.FormatResourceID(*req.Ref.ResourceId), req.Ref.Path)
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 95ef49d

Please sign in to comment.