Skip to content

Commit

Permalink
Fix public link paths for file shares (cs3org#2297)
Browse files Browse the repository at this point in the history
  • Loading branch information
ishank011 authored Nov 22, 2021
1 parent 0ffb38f commit 29826a3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
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

0 comments on commit 29826a3

Please sign in to comment.