web/satellite: fix object browser auto preview feature

Fix for an issue:
uploading folder triggers object preview modal to show up if there is already and only 1 uploaded object in this bucket.

By this fix we check if uploading object has prefix (basically folder) so we don't trigger object preview automatically.

Change-Id: I32943ef81c19d4ba1960ecb2f15126dfb381d845
This commit is contained in:
Vitalii 2023-04-17 17:53:54 +03:00 committed by Storj Robot
parent 771d2269ab
commit 3e93c53560
2 changed files with 8 additions and 13 deletions

View File

@ -562,13 +562,11 @@ export const makeFilesModule = (): FilesModule => ({
(file) => file.type === 'file',
);
if (uploadedFiles.length === 1) {
if (state.openModalOnFirstUpload === true) {
if (uploadedFiles.length === 1 && !path && state.openModalOnFirstUpload) {
commit('setObjectPathForModal', params.Key);
const appStore = useAppStore();
appStore.updateActiveModal(MODALS.objectDetails);
}
}
commit('finishUpload', params.Key);
});

View File

@ -423,14 +423,11 @@ export const useFilesStore = defineStore('files', () => {
(file) => file.type === 'file',
);
if (uploadedFiles.length === 1) {
if (state.openModalOnFirstUpload) {
if (uploadedFiles.length === 1 && !path && state.openModalOnFirstUpload) {
state.objectPathForModal = params.Key;
const appStore = useAppStore();
appStore.updateActiveModal(MODALS.objectDetails);
}
}
state.uploading = state.uploading.filter((file) => file.Key !== params.Key);
});