Skip to content

Commit

Permalink
Fix content disposition (cs3org#2303)
Browse files Browse the repository at this point in the history
* make content disposition reflect request base path

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* Revert "Fix public link paths for file shares (cs3org#2297)"

This reverts commit 29826a3.

* Add content disposition fix changelog

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
  • Loading branch information
butonic authored Dec 2, 2021
1 parent 7f15205 commit 3cba223
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 4 additions & 0 deletions changelog/unreleased/fix-content-disposition.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Bugfix: Fix content disposition header for public links files

https://github.com/cs3org/reva/pull/2303
https://github.com/cs3org/reva/pull/2297
3 changes: 0 additions & 3 deletions changelog/unreleased/fix-public-share-paths.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,7 @@ func (s *service) translatePublicRefToCS3Ref(ctx context.Context, ref *provider.
return nil, "", nil, st, nil
}

p := shareInfo.Path
if shareInfo.Type != provider.ResourceType_RESOURCE_TYPE_FILE {
p = path.Join("/", shareInfo.Path, relativePath)
}
cs3Ref := &provider.Reference{Path: p}

cs3Ref := &provider.Reference{Path: path.Join("/", shareInfo.Path, relativePath)}
log.Debug().
Interface("sourceRef", ref).
Interface("cs3Ref", cs3Ref).
Expand Down
2 changes: 1 addition & 1 deletion internal/http/services/owncloud/ocdav/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (s *svc) handleGet(ctx context.Context, w http.ResponseWriter, r *http.Requ

w.Header().Set(HeaderContentType, info.MimeType)
w.Header().Set(HeaderContentDisposistion, "attachment; filename*=UTF-8''"+
path.Base(info.Path)+"; filename=\""+path.Base(info.Path)+"\"")
path.Base(r.RequestURI)+"; filename=\""+path.Base(r.RequestURI)+"\"")
w.Header().Set(HeaderETag, info.Etag)
w.Header().Set(HeaderOCFileID, wrapResourceID(info.Id))
w.Header().Set(HeaderOCETag, info.Etag)
Expand Down
4 changes: 4 additions & 0 deletions internal/http/services/owncloud/ocdav/publicfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ func (h *PublicFileHandler) Handler(s *svc) http.Handler {
return
}

r.URL.Path = path.Base(r.URL.Path)
switch r.Method {
case MethodPropfind:
s.handlePropfindOnToken(w, r, h.namespace, false)
Expand Down Expand Up @@ -120,6 +121,9 @@ func (s *svc) adjustResourcePathInURL(w http.ResponseWriter, r *http.Request) bo
return false
}

// adjust path in request URL to point at the parent
r.URL.Path = path.Dir(r.URL.Path)

return true
}

Expand Down

0 comments on commit 3cba223

Please sign in to comment.