Skip to content

Commit 6d8c87b

Browse files
committed
fix: encode uri for trashbin delete
Replace d280912 with a cleaner approach. Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
1 parent e9189e0 commit 6d8c87b

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

apps/files/src/actions/deleteAction.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import TrashCan from '@mdi/svg/svg/trash-can.svg?raw'
2828
import { registerFileAction, FileAction } from '../services/FileAction.ts'
2929
import logger from '../logger.js'
3030
import type { Navigation } from '../services/Navigation.ts'
31+
import { encodePath } from '@nextcloud/paths';
3132

3233
registerFileAction(new FileAction({
3334
id: 'delete',
@@ -45,8 +46,11 @@ registerFileAction(new FileAction({
4546
},
4647

4748
async exec(node: Node) {
49+
const { origin } = new URL(node.source)
50+
const encodedSource = origin + encodePath(node.source.slice(origin.length))
51+
4852
try {
49-
await axios.delete(node.source)
53+
await axios.delete(encodedSource)
5054

5155
// Let's delete even if it's moved to the trashbin
5256
// since it has been removed from the current view

dist/files-main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)