fix: encode uri for trashbin delete

Replace d280912f31 with a cleaner approach.

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
This commit is contained in:
Daniel Kesselberg 2023-10-03 17:45:17 +02:00
parent ffe533d3fc
commit ce0cc84c21
No known key found for this signature in database
GPG key ID: 36E3664E099D0614
4 changed files with 8 additions and 5 deletions

View file

@ -51,11 +51,14 @@ registerFileAction(new FileAction({
},
async exec(node: Node) {
const { origin } = new URL(node.source)
const encodedSource = origin + encodePath(node.source.slice(origin.length))
try {
const destination = generateRemoteUrl(encodePath(`dav/trashbin/${getCurrentUser()?.uid}/restore/${node.basename}`))
await axios({
method: 'MOVE',
url: node.source,
url: encodedSource,
headers: {
destination,
},

View file

@ -58,7 +58,7 @@ const resultToNode = function(node: FileStat): File | Folder {
const nodeData = {
id: node.props?.fileid as number || 0,
source: generateRemoteUrl(encodePath('dav' + rootPath + node.filename)),
source: generateRemoteUrl('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