Skip to content

Commit

Permalink
fix: encode uri for trashbin delete
Browse files Browse the repository at this point in the history
Replace d280912 with a cleaner approach.

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
  • Loading branch information
kesselb committed Oct 31, 2023
1 parent e9189e0 commit 6d8c87b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion apps/files/src/actions/deleteAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions dist/files-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-main.js.map

Large diffs are not rendered by default.

0 comments on commit 6d8c87b

Please sign in to comment.