fix: encode uri for trashbin delete

Replace d280912 with a cleaner approach.

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
This commit is contained in:
Daniel Kesselberg 2023-10-28 16:26:42 +02:00
parent a61c609e92
commit b0f9113eba
No known key found for this signature in database
GPG key ID: 36E3664E099D0614
3 changed files with 8 additions and 4 deletions

View file

@ -28,6 +28,7 @@ import TrashCan from '@mdi/svg/svg/trash-can.svg?raw'
import { registerFileAction, FileAction } from '../services/FileAction.ts'
import logger from '../logger.js'
import type { Navigation } from '../services/Navigation.ts'
import { encodePath } from '@nextcloud/paths';
registerFileAction(new FileAction({
id: 'delete',
@ -45,8 +46,11 @@ registerFileAction(new FileAction({
},
async exec(node: Node) {
const { origin } = new URL(node.source)
const encodedSource = origin + encodePath(node.source.slice(origin.length))
try {
await axios.delete(node.source)
await axios.delete(encodedSource)
// Let's delete even if it's moved to the trashbin
// since it has been removed from the current view

4
dist/files-main.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long