]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(dav): file request guest nickname encoding
authorskjnldsv <skjnldsv@protonmail.com>
Tue, 12 Nov 2024 11:45:16 +0000 (12:45 +0100)
committernextcloud-command <nextcloud-command@users.noreply.github.com>
Tue, 12 Nov 2024 22:38:40 +0000 (22:38 +0000)
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
apps/dav/lib/Files/Sharing/FilesDropPlugin.php
apps/files_sharing/src/public-file-request.ts

index 69328d42272c697a3ba73bac8e2ef73828eb0f21..9d883be81fce52ae9173965d982b87f1b4476950 100644 (file)
@@ -64,7 +64,7 @@ class FilesDropPlugin extends ServerPlugin {
                // Extract the attributes for the file request
                $isFileRequest = false;
                $attributes = $this->share->getAttributes();
-               $nickName = $request->getHeader('X-NC-Nickname');
+               $nickName = $request->hasHeader('X-NC-Nickname') ? urldecode($request->getHeader('X-NC-Nickname')) : null;
                if ($attributes !== null) {
                        $isFileRequest = $attributes->getAttribute('fileRequest', 'enabled') === true;
                }
index 92db2440525d7dc38b0db9cfe23df33eb8acac7f..1d640c5ea5e0926948313275e9beda732edc71e1 100644 (file)
@@ -3,12 +3,13 @@
  * SPDX-License-Identifier: AGPL-3.0-or-later
  */
 
+import { defineAsyncComponent } from 'vue'
+import { getBuilder } from '@nextcloud/browser-storage'
 import { getGuestNickname, setGuestNickname } from '@nextcloud/auth'
-import { spawnDialog } from '@nextcloud/dialogs'
 import { getUploader } from '@nextcloud/upload'
-import { defineAsyncComponent } from 'vue'
+import { spawnDialog } from '@nextcloud/dialogs'
+
 import logger from './services/logger'
-import { getBuilder } from '@nextcloud/browser-storage'
 
 const storage = getBuilder('files_sharing').build()
 
@@ -18,7 +19,7 @@ const storage = getBuilder('files_sharing').build()
  */
 function registerFileRequestHeader(nickname: string) {
        const uploader = getUploader()
-       uploader.setCustomHeader('X-NC-Nickname', nickname)
+       uploader.setCustomHeader('X-NC-Nickname', encodeURIComponent(nickname))
        logger.debug('Nickname header registered for uploader', { headers: uploader.customHeaders })
 }