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 opening images in media viewer for some usernames #2738

Merged
merged 1 commit into from
Nov 9, 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
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-mediaviewer-url-encoded.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Fix opening images in media viewer for some usernames

We've fixed the opening of images in the media viewer for user names containing special characters (eg. `@`) which will be URL-escaped. Before this fix users could not see the image in the media viewer. Now the user name is correctly escaped and the user can view the image in the media viewer.

https://github.com/owncloud/ocis/pull/2738
5 changes: 5 additions & 0 deletions webdav/pkg/dav/requests/thumbnail.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,15 @@ func ParseThumbnailRequest(r *http.Request) (*ThumbnailRequest, error) {
// So using the URLParam function is not possible.
func extractFilePath(r *http.Request) (string, error) {
user := chi.URLParam(r, "user")
user, err := url.QueryUnescape(user)
if err != nil {
return "", errors.New("could not unescape user")
}
if user != "" {
parts := strings.SplitN(r.URL.Path, user, 2)
return parts[1], nil
}

token := chi.URLParam(r, "token")
if token != "" {
parts := strings.SplitN(r.URL.Path, token, 2)
Expand Down