Skip to content

Commit

Permalink
Merge pull request #49226 from nextcloud/fix/encode-guest-file-request
Browse files Browse the repository at this point in the history
fx(dav): file request guest nickname encoding
  • Loading branch information
skjnldsv authored Nov 12, 2024
2 parents de1c175 + 94d22a7 commit 034106d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion apps/dav/lib/Files/Sharing/FilesDropPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
9 changes: 5 additions & 4 deletions apps/files_sharing/src/public-file-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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 })
}

Expand Down
4 changes: 2 additions & 2 deletions dist/files_sharing-public-file-request.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files_sharing-public-file-request.js.map

Large diffs are not rendered by default.

0 comments on commit 034106d

Please sign in to comment.