Skip to content

Commit a775377

Browse files
committed
fix(files): encoded source path on actions requests
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
1 parent 8f30f97 commit a775377

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

apps/files/src/actions/deleteAction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const action = new FileAction({
4444

4545
async exec(node: Node) {
4646
try {
47-
await axios.delete(node.source)
47+
await axios.delete(node.encodedSource)
4848

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

apps/files/src/components/FileEntry.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ export default Vue.extend({
845845
// Rename and move the file
846846
async onRename() {
847847
const oldName = this.source.basename
848-
const oldSource = this.source.source
848+
const oldEncodedSource = this.source.encodedSource
849849
const newName = this.newName.trim?.() || ''
850850
if (newName === '') {
851851
showError(this.t('files', 'Name cannot be empty'))
@@ -870,12 +870,13 @@ export default Vue.extend({
870870
// Update node
871871
this.source.rename(newName)
872872
873+
logger.debug('Moving file to', { destination: this.source.encodedSource, oldEncodedSource })
873874
try {
874875
await axios({
875876
method: 'MOVE',
876-
url: oldSource,
877+
url: oldEncodedSource,
877878
headers: {
878-
Destination: encodeURI(this.source.source),
879+
Destination: this.source.encodedSource,
879880
},
880881
})
881882

apps/files/src/services/Files.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import { getCurrentUser } from '@nextcloud/auth'
3030
import { getClient, rootPath } from './WebdavClient'
3131
import { hashCode } from '../utils/hashUtils'
3232
import logger from '../logger'
33-
import { encodePath } from '@nextcloud/paths'
3433

3534
const client = getClient()
3635

@@ -45,7 +44,7 @@ export const resultToNode = function(node: FileStat): File | Folder {
4544
const permissions = davParsePermissions(props?.permissions)
4645
const owner = getCurrentUser()?.uid as string
4746

48-
const source = generateRemoteUrl(encodePath('dav' + rootPath + node.filename))
47+
const source = generateRemoteUrl('dav' + rootPath + node.filename)
4948
const id = props?.fileid < 0
5049
? hashCode(source)
5150
: props?.fileid as number || 0

apps/files_trashbin/src/actions/restoreAction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ registerFileAction(new FileAction({
5454
const destination = generateRemoteUrl(encodePath(`dav/trashbin/${getCurrentUser()?.uid}/restore/${node.basename}`))
5555
await axios({
5656
method: 'MOVE',
57-
url: node.source,
57+
url: node.encodedSource,
5858
headers: {
5959
destination,
6060
},

apps/files_trashbin/src/services/trashbin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const resultToNode = function(node: FileStat): File | Folder {
4646

4747
const nodeData = {
4848
id: node.props?.fileid as number || 0,
49-
source: generateRemoteUrl(encodePath('dav' + rootPath + node.filename)),
49+
source: generateRemoteUrl('dav' + rootPath + node.filename),
5050
// do not show the mtime column
5151
// mtime: new Date(node.lastmod),
5252
mime: node.mime as string,

0 commit comments

Comments
 (0)