From: skjnldsv Date: Tue, 12 Nov 2024 11:45:16 +0000 (+0100) Subject: fix(dav): file request guest nickname encoding X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=bfe8f8af40d82cb092e652bc4b906aaeb33ab732;p=nextcloud-server.git fix(dav): file request guest nickname encoding Signed-off-by: skjnldsv --- diff --git a/apps/dav/lib/Files/Sharing/FilesDropPlugin.php b/apps/dav/lib/Files/Sharing/FilesDropPlugin.php index 69328d42272..9d883be81fc 100644 --- a/apps/dav/lib/Files/Sharing/FilesDropPlugin.php +++ b/apps/dav/lib/Files/Sharing/FilesDropPlugin.php @@ -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; } diff --git a/apps/files_sharing/src/public-file-request.ts b/apps/files_sharing/src/public-file-request.ts index 92db2440525..1d640c5ea5e 100644 --- a/apps/files_sharing/src/public-file-request.ts +++ b/apps/files_sharing/src/public-file-request.ts @@ -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 }) }