Skip to content

Commit

Permalink
Merge pull request #41176 from nextcloud/encode-uri-trashbin-delete-3
Browse files Browse the repository at this point in the history
fix: encode uri for trashbin delete (the second one)
  • Loading branch information
AndyScherzinger authored Nov 14, 2023
2 parents 4b19cda + b0f9113 commit 13ec839
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 13ec839

Please sign in to comment.