From bf728f9d5149c389f45713f81f10666972c31f73 Mon Sep 17 00:00:00 2001 From: skjnldsv Date: Tue, 12 Nov 2024 12:45:16 +0100 Subject: [PATCH] fix(dav): file request guest nickname encoding Signed-off-by: skjnldsv --- apps/dav/lib/Files/Sharing/FilesDropPlugin.php | 2 +- apps/files_sharing/js/files_drop.js | 2 +- build/integration/features/bootstrap/FilesDropContext.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/dav/lib/Files/Sharing/FilesDropPlugin.php b/apps/dav/lib/Files/Sharing/FilesDropPlugin.php index 69328d42272c6..9d883be81fce5 100644 --- a/apps/dav/lib/Files/Sharing/FilesDropPlugin.php +++ b/apps/dav/lib/Files/Sharing/FilesDropPlugin.php @@ -64,7 +64,7 @@ public function beforeMethod(RequestInterface $request, ResponseInterface $respo // 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/js/files_drop.js b/apps/files_sharing/js/files_drop.js index 450af078af269..b2df2f496a7eb 100644 --- a/apps/files_sharing/js/files_drop.js +++ b/apps/files_sharing/js/files_drop.js @@ -48,7 +48,7 @@ } if (localStorage.getItem('nick') !== null) { - data.headers['X-NC-Nickname'] = localStorage.getItem('nick') + data.headers['X-NC-Nickname'] = encodeURIComponent(localStorage.getItem('nick')) } $('#drop-upload-done-indicator').addClass('hidden'); diff --git a/build/integration/features/bootstrap/FilesDropContext.php b/build/integration/features/bootstrap/FilesDropContext.php index 1b9d598645fa1..e70c9c72d4006 100644 --- a/build/integration/features/bootstrap/FilesDropContext.php +++ b/build/integration/features/bootstrap/FilesDropContext.php @@ -32,7 +32,7 @@ public function droppingFileWith($path, $content, $nickName = null) { ]; if ($nickName) { - $options['headers']['X-NC-NICKNAME'] = $nickName; + $options['headers']['X-NC-NICKNAME'] = urlencode($nickName); } $options['body'] = \GuzzleHttp\Psr7\Utils::streamFor($content);