diff --git a/internal/grpc/services/storageprovider/storageprovider.go b/internal/grpc/services/storageprovider/storageprovider.go index 950e55f441..5676cf3ef7 100644 --- a/internal/grpc/services/storageprovider/storageprovider.go +++ b/internal/grpc/services/storageprovider/storageprovider.go @@ -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 { diff --git a/pkg/rhttp/datatx/utils/download/download.go b/pkg/rhttp/datatx/utils/download/download.go index aa34bd73dd..bf9cd76dd6 100644 --- a/pkg/rhttp/datatx/utils/download/download.go +++ b/pkg/rhttp/datatx/utils/download/download.go @@ -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") != "" {