Skip to content

Commit a0463cf

Browse files
committed
fix: encode uri for trashbin delete
Signed-off-by: Daniel Kesselberg <[email protected]>
1 parent e0adcc5 commit a0463cf

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

apps/files_trashbin/src/actions/restoreAction.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import History from '@mdi/svg/svg/history.svg?raw'
2929

3030
import { registerFileAction, FileAction } from '../../../files/src/services/FileAction.ts'
3131
import logger from '../../../files/src/logger.js'
32+
import { encodePath } from '@nextcloud/paths'
3233

3334
registerFileAction(new FileAction({
3435
id: 'restore',
@@ -51,7 +52,7 @@ registerFileAction(new FileAction({
5152

5253
async exec(node: Node) {
5354
try {
54-
const destination = generateRemoteUrl(encodeURI(`dav/trashbin/${getCurrentUser()?.uid}/restore/${node.basename}`))
55+
const destination = generateRemoteUrl(encodePath(`dav/trashbin/${getCurrentUser()?.uid}/restore/${node.basename}`))
5556
await axios({
5657
method: 'MOVE',
5758
url: node.source,

apps/files_trashbin/src/services/trashbin.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import type { FileStat, ResponseDataDetailed } from 'webdav'
2828
import type { ContentsWithRoot } from '../../../files/src/services/Navigation.ts'
2929

3030
import client, { rootPath } from './client'
31+
import { encodePath } from '@nextcloud/paths'
3132

3233
const data = `<?xml version="1.0"?>
3334
<d:propfind xmlns:d="DAV:"
@@ -57,7 +58,7 @@ const resultToNode = function(node: FileStat): File | Folder {
5758

5859
const nodeData = {
5960
id: node.props?.fileid as number || 0,
60-
source: generateRemoteUrl('dav' + rootPath + node.filename),
61+
source: generateRemoteUrl(encodePath('dav' + rootPath + node.filename)),
6162
mtime: new Date(node.lastmod),
6263
mime: node.mime as string,
6364
size: node.props?.size as number || 0,

0 commit comments

Comments
 (0)