fix: encode uri for trashbin delete

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
This commit is contained in:
Daniel Kesselberg 2023-09-26 16:29:58 +02:00
parent e0adcc587e
commit d280912f31
No known key found for this signature in database
GPG key ID: 36E3664E099D0614
4 changed files with 7 additions and 5 deletions

View file

@ -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',
@ -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,

View file

@ -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:"
@ -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,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long