Skip to content

Commit

Permalink
get rid of public link url hash
Browse files Browse the repository at this point in the history
  • Loading branch information
fschade committed Mar 1, 2022
1 parent 1fd81b0 commit 16ec8b8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
7 changes: 7 additions & 0 deletions changelog/unreleased/change-public-link-hash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Change: Remove hash from public link urls

Public link urls do not contain the hash anymore, this is needed to support the ocis and web history mode.

https://github.com/cs3org/reva/pull/2596
https://github.com/owncloud/ocis/pull/3109
https://github.com/owncloud/web/pull/6363
5 changes: 3 additions & 2 deletions internal/http/services/owncloud/ocdav/ocdav.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,9 @@ func (s *svc) Handler() http.Handler {
head, r.URL.Path = router.ShiftPath(r.URL.Path)
if head == "s" {
token := r.URL.Path
url := s.c.PublicURL + path.Join("#", head, token)
http.Redirect(w, r, url, http.StatusMovedPermanently)
rURL := s.c.PublicURL + path.Join(head, token)

http.Redirect(w, r, rURL, http.StatusMovedPermanently)
return
}
}
Expand Down
6 changes: 5 additions & 1 deletion internal/http/services/owncloud/ocs/conversions/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"context"
"fmt"
"net/http"
"net/url"
"path"
"time"

Expand Down Expand Up @@ -205,14 +206,17 @@ func CS3Share2ShareData(ctx context.Context, share *collaboration.Share) (*Share

// PublicShare2ShareData converts a cs3api public share into shareData data model
func PublicShare2ShareData(share *link.PublicShare, r *http.Request, publicURL string) *ShareData {
sdURL, _ := url.ParseRequestURI(publicURL)
sdURL.Path = path.Join(sdURL.Path, "s", share.Token)

sd := &ShareData{
// share.permissions are mapped below
// Displaynames are added later
ShareType: ShareTypePublicLink,
Token: share.Token,
Name: share.DisplayName,
MailSend: 0,
URL: publicURL + path.Join("/", "#/s/"+share.Token),
URL: sdURL.String(),
UIDOwner: LocalUserIDToString(share.Creator),
UIDFileOwner: LocalUserIDToString(share.Owner),
}
Expand Down

0 comments on commit 16ec8b8

Please sign in to comment.