fix: copying files with special characters

pull/1373/head
Ramires Viana 2021-04-15 11:50:30 +00:00
parent ba7e71a7c3
commit 20ebbf6611
2 changed files with 13 additions and 15 deletions

View File

@ -151,13 +151,13 @@ export default {
for (let i of this.selected) {
items.push({
from: this.req.items[i].url,
to: this.url + this.req.items[i].name,
to: this.url + encodeURIComponent(this.req.items[i].name),
name: this.req.items[i].name,
});
}
let base = el.querySelector(".name").innerHTML + "/";
let path = this.$route.path + base;
// Get url from ListingItem instance
let path = el.__vue__.url;
let baseItems = (await api.fetch(path)).items;
let action = (overwrite, rename) => {

View File

@ -492,7 +492,7 @@ export default {
for (let i of this.selected) {
items.push({
from: this.req.items[i].url,
name: encodeURIComponent(this.req.items[i].name),
name: this.req.items[i].name,
});
}
@ -517,7 +517,7 @@ export default {
const from = item.from.endsWith("/")
? item.from.slice(0, -1)
: item.from;
const to = this.$route.path + item.name;
const to = this.$route.path + encodeURIComponent(item.name);
items.push({ from, to, name: item.name });
}
@ -639,22 +639,20 @@ export default {
}
}
let base = "";
let files = await upload.scanFiles(dt);
let items = this.req.items;
let path = this.$route.path.endsWith("/")
? this.$route.path
: this.$route.path + "/";
if (
el !== null &&
el.classList.contains("item") &&
el.dataset.dir === "true"
) {
base = el.querySelector(".name").innerHTML + "/";
}
// Get url from ListingItem instance
path = el.__vue__.url;
let files = await upload.scanFiles(dt);
let path = this.$route.path.endsWith("/")
? this.$route.path + base
: this.$route.path + "/" + base;
let items = this.req.items;
if (base !== "") {
try {
items = (await api.fetch(path)).items;
} catch (error) {