Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable27] fix: encode uri for trashbin delete #40757

Merged
merged 1 commit into from Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion apps/files_trashbin/src/actions/restoreAction.ts
Expand Up @@ -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,
},
Expand Down
2 changes: 1 addition & 1 deletion apps/files_trashbin/src/services/trashbin.ts
Expand Up @@ -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,
Expand Down