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
Henrique Dias 2019-01-26 10:46:48 +00:00 committed by GitHub
parent b394540f53
commit dd29a87107
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 6 additions and 6 deletions

View File

@ -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 += '/'

View File

@ -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)
})
}

View File

@ -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)
})
}

View File

@ -53,7 +53,7 @@ export default {
uri = url.removeLastDir(uri) + '/'
}
uri += this.name + '/'
uri += encodeURIComponent(this.name) + '/'
uri = uri.replace('//', '/')
try {

View File

@ -53,7 +53,7 @@ export default {
uri = url.removeLastDir(uri) + '/'
}
uri += this.name
uri += encodeURIComponent(this.name)
uri = uri.replace('//', '/')
try {

View File

@ -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 }])