Update FileTable.vue

This commit is contained in:
GMrrc 2024-11-25 14:26:26 +01:00
parent 72af269615
commit 7920b0706c

View File

@ -279,6 +279,7 @@ export default {
this.isDragging = false; this.isDragging = false;
this.isTransfering = true; this.isTransfering = true;
const file = this.file; const file = this.file;
console.log(file);
if (!file) return; if (!file) return;
if (file.isDirectory) { if (file.isDirectory) {
@ -303,7 +304,7 @@ export default {
} }
}, },
async moveFilesOfFolder(folder, parentPath) { async moveFilesOfFolder(folder, parentPath) {
await this.createFolder(folder, parentPath); await this.createFolder(folder, parentPath + '/');
const checkChildrenInChildren = (folder) => { const checkChildrenInChildren = (folder) => {
let total = folder.children.length; let total = folder.children.length;
for (const child of folder.children) { for (const child of folder.children) {
@ -319,12 +320,12 @@ export default {
for (const child of folder.children) { for (const child of folder.children) {
this.transferProgress += progressSteps; this.transferProgress += progressSteps;
if (child.isDirectory) { if (child.isDirectory) {
await this.moveFilesOfFolder(child, parentPath + child.parentPath + '/'); await this.moveFilesOfFolder(child, parentPath + '/' + child.parentPath + '/');
} else { } else {
if (child.content && typeof child.content.arrayBuffer === 'function') { if (child.content && typeof child.content.arrayBuffer === 'function') {
child.content = await child.content.arrayBuffer(); child.content = await child.content.arrayBuffer();
} }
await this.moveFileToTarget(child, parentPath + child.parentPath + '/'); await this.moveFileToTarget(child, parentPath + '/' + child.parentPath + '/');
} }
} }
}, },
@ -334,12 +335,7 @@ export default {
// Assurez-vous que le chemin parent est correctement formaté // Assurez-vous que le chemin parent est correctement formaté
let fullPath = ''; let fullPath = '';
if(parentPath[parentPath.length - 1] === '/') {
fullPath = `${this.root_path}${this.current_dir}${parentPath}${file.name}`; fullPath = `${this.root_path}${this.current_dir}${parentPath}${file.name}`;
}
else{
fullPath = `${this.root_path}${this.current_dir}${parentPath}/${file.name}`;
}
if (ArrayBuffer.isView(file.content)) { if (ArrayBuffer.isView(file.content)) {
file.content = Buffer.from(file.content); file.content = Buffer.from(file.content);
@ -364,12 +360,7 @@ export default {
try { try {
const client = getClient(); const client = getClient();
let fullPath = ''; let fullPath = '';
if(parentPath[parentPath.length - 1] === '/') {
fullPath = `${this.root_path}${this.current_dir}${parentPath}${folder.name}`; fullPath = `${this.root_path}${this.current_dir}${parentPath}${folder.name}`;
}
else{
fullPath = `${this.root_path}${this.current_dir}${parentPath}/${folder.name}`;
}
const alreadyExists = await this.elemtAlreadyExists(fullPath); const alreadyExists = await this.elemtAlreadyExists(fullPath);
if(!alreadyExists) { if(!alreadyExists) {
@ -386,7 +377,7 @@ export default {
async deleteElem(file){ async deleteElem(file){
const client = getClient() const client = getClient()
try{ try{
let path = this.root_path + this.current_dir + file.basename; let path = this.root_path + this.current_dir + "/" + file.basename;
await client.deleteFile(path); await client.deleteFile(path);
} }
catch(error){ catch(error){