Skip to content
This repository was archived by the owner on May 6, 2025. It is now read-only.

Commit dd29a87

Browse files
authored
fix: correctly encode URIs (#85)
* fix: correctly encode URIs License: MIT Signed-off-by: Henrique Dias <[email protected]> * fix: encode uri component on copy, move and rename License: MIT Signed-off-by: Henrique Dias <[email protected]>
1 parent b394540 commit dd29a87

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

src/api/files.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export async function fetch (url) {
99

1010
if (res.status === 200) {
1111
let data = await res.json()
12-
data.url = `/files${data.path}`
12+
data.url = `/files${url}`
1313

1414
if (data.isDir) {
1515
if (!data.url.endsWith('/')) data.url += '/'

src/components/prompts/Copy.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export default {
4949
for (let item of this.selected) {
5050
items.push({
5151
from: this.req.items[item].url,
52-
to: this.dest + this.req.items[item].name
52+
to: this.dest + encodeURIComponent(this.req.items[item].name)
5353
})
5454
}
5555

src/components/prompts/Move.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default {
4747
for (let item of this.selected) {
4848
items.push({
4949
from: this.req.items[item].url,
50-
to: this.dest + this.req.items[item].name
50+
to: this.dest + encodeURIComponent(this.req.items[item].name)
5151
})
5252
}
5353

src/components/prompts/NewDir.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export default {
5353
uri = url.removeLastDir(uri) + '/'
5454
}
5555
56-
uri += this.name + '/'
56+
uri += encodeURIComponent(this.name) + '/'
5757
uri = uri.replace('//', '/')
5858
5959
try {

src/components/prompts/NewFile.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export default {
5353
uri = url.removeLastDir(uri) + '/'
5454
}
5555
56-
uri += this.name
56+
uri += encodeURIComponent(this.name)
5757
uri = uri.replace('//', '/')
5858
5959
try {

src/components/prompts/Rename.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export default {
6868
oldLink = this.req.items[this.selected[0]].url
6969
}
7070
71-
newLink = url.removeLastDir(oldLink) + '/' + this.name
71+
newLink = url.removeLastDir(oldLink) + '/' + encodeURIComponent(this.name)
7272
7373
try {
7474
await api.move([{ from: oldLink, to: newLink }])

0 commit comments

Comments
 (0)