From 94fbdfae448f7609a255236e62a7142848c818f6 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Wed, 3 Nov 2021 13:50:44 +0300 Subject: [PATCH] Web: Files: fixed upload to tree menu --- .../ASC.Files/Client/src/store/UploadDataStore.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/products/ASC.Files/Client/src/store/UploadDataStore.js b/products/ASC.Files/Client/src/store/UploadDataStore.js index 7e17404877..eb7766c3cc 100644 --- a/products/ASC.Files/Client/src/store/UploadDataStore.js +++ b/products/ASC.Files/Client/src/store/UploadDataStore.js @@ -463,19 +463,22 @@ class UploadDataStore { if (window.location.pathname.indexOf("/history") === -1) { const newFiles = files; const newFolders = folders; + const path = currentFile.path; + + if (path[path.length - 1] !== this.selectedFolderStore.id) { + return; + } let folderInfo = null; - const index = currentFile.path.findIndex( - (x) => x === this.selectedFolderStore.id - ); - const folderId = currentFile.path[index + 1]; + const index = path.findIndex((x) => x === this.selectedFolderStore.id); + const folderId = index !== -1 ? path[index + 1] : null; if (folderId) folderInfo = await getFolderInfo(folderId); const newPath = []; if (folderInfo) { let i = 0; - while (currentFile.path[i] && currentFile.path[i] !== folderId) { - newPath.push(currentFile.path[i]); + while (path[i] && path[i] !== folderId) { + newPath.push(path[i]); i++; } }