fix: correctly encode URIs (#85)
* fix: correctly encode URIs License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com> * fix: encode uri component on copy, move and rename License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>pull/739/head
parent
b394540f53
commit
dd29a87107
|
@ -9,7 +9,7 @@ export async function fetch (url) {
|
|||
|
||||
if (res.status === 200) {
|
||||
let data = await res.json()
|
||||
data.url = `/files${data.path}`
|
||||
data.url = `/files${url}`
|
||||
|
||||
if (data.isDir) {
|
||||
if (!data.url.endsWith('/')) data.url += '/'
|
||||
|
|
|
@ -49,7 +49,7 @@ export default {
|
|||
for (let item of this.selected) {
|
||||
items.push({
|
||||
from: this.req.items[item].url,
|
||||
to: this.dest + this.req.items[item].name
|
||||
to: this.dest + encodeURIComponent(this.req.items[item].name)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ export default {
|
|||
for (let item of this.selected) {
|
||||
items.push({
|
||||
from: this.req.items[item].url,
|
||||
to: this.dest + this.req.items[item].name
|
||||
to: this.dest + encodeURIComponent(this.req.items[item].name)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ export default {
|
|||
uri = url.removeLastDir(uri) + '/'
|
||||
}
|
||||
|
||||
uri += this.name + '/'
|
||||
uri += encodeURIComponent(this.name) + '/'
|
||||
uri = uri.replace('//', '/')
|
||||
|
||||
try {
|
||||
|
|
|
@ -53,7 +53,7 @@ export default {
|
|||
uri = url.removeLastDir(uri) + '/'
|
||||
}
|
||||
|
||||
uri += this.name
|
||||
uri += encodeURIComponent(this.name)
|
||||
uri = uri.replace('//', '/')
|
||||
|
||||
try {
|
||||
|
|
|
@ -68,7 +68,7 @@ export default {
|
|||
oldLink = this.req.items[this.selected[0]].url
|
||||
}
|
||||
|
||||
newLink = url.removeLastDir(oldLink) + '/' + this.name
|
||||
newLink = url.removeLastDir(oldLink) + '/' + encodeURIComponent(this.name)
|
||||
|
||||
try {
|
||||
await api.move([{ from: oldLink, to: newLink }])
|
||||
|
|
Loading…
Reference in New Issue