Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix public link paths for file shares #2297

Merged
merged 1 commit into from
Nov 22, 2021
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
3 changes: 3 additions & 0 deletions changelog/unreleased/fix-public-share-paths.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Bugfix: Fix public link paths for file shares

https://github.com/cs3org/reva/pull/2297
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,12 @@ func (s *service) translatePublicRefToCS3Ref(ctx context.Context, ref *provider.
return nil, "", nil, st, nil
}

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

log.Debug().
Interface("sourceRef", ref).
Interface("cs3Ref", cs3Ref).
Expand Down
4 changes: 0 additions & 4 deletions internal/http/services/owncloud/ocdav/publicfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ 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 @@ -121,9 +120,6 @@ 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