mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-02-24 22:49:06 -06:00
fix opening images in media viewer for some usernames
This commit is contained in:
5
changelog/unreleased/fix-mediaviewer-url-encoded.md
Normal file
5
changelog/unreleased/fix-mediaviewer-url-encoded.md
Normal file
@@ -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
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user