Skip to content

Commit

Permalink
fix: encode uri for trashbin delete
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
  • Loading branch information
kesselb committed Sep 26, 2023
1 parent e0adcc5 commit d280912
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion apps/files_trashbin/src/actions/restoreAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import History from '@mdi/svg/svg/history.svg?raw'

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

registerFileAction(new FileAction({
id: 'restore',
Expand All @@ -51,7 +52,7 @@ registerFileAction(new FileAction({

async exec(node: Node) {
try {
const destination = generateRemoteUrl(encodeURI(`dav/trashbin/${getCurrentUser()?.uid}/restore/${node.basename}`))
const destination = generateRemoteUrl(encodePath(`dav/trashbin/${getCurrentUser()?.uid}/restore/${node.basename}`))
await axios({
method: 'MOVE',
url: node.source,
Expand Down
3 changes: 2 additions & 1 deletion apps/files_trashbin/src/services/trashbin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import type { FileStat, ResponseDataDetailed } from 'webdav'
import type { ContentsWithRoot } from '../../../files/src/services/Navigation.ts'

import client, { rootPath } from './client'
import { encodePath } from '@nextcloud/paths'

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

const nodeData = {
id: node.props?.fileid as number || 0,
source: generateRemoteUrl('dav' + rootPath + node.filename),
source: generateRemoteUrl(encodePath('dav' + rootPath + node.filename)),
mtime: new Date(node.lastmod),
mime: node.mime as string,
size: node.props?.size as number || 0,
Expand Down
Loading

0 comments on commit d280912

Please sign in to comment.