diff options
Diffstat (limited to 'apps/files/src/views/Sidebar.vue')
-rw-r--r-- | apps/files/src/views/Sidebar.vue | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/apps/files/src/views/Sidebar.vue b/apps/files/src/views/Sidebar.vue index f3d6fe7972e..65e4c302632 100644 --- a/apps/files/src/views/Sidebar.vue +++ b/apps/files/src/views/Sidebar.vue @@ -451,39 +451,41 @@ export default { * @throws {Error} loading failure */ async open(path) { + if (!path || path.trim() === '') { + throw new Error(`Invalid path '${path}'`) + } + // update current opened file this.Sidebar.file = path - if (path && path.trim() !== '') { - // reset data, keep old fileInfo to not reload all tabs and just hide them - this.error = null - this.loading = true + // reset data, keep old fileInfo to not reload all tabs and just hide them + this.error = null + this.loading = true - try { - this.fileInfo = await FileInfo(this.davPath) - // adding this as fallback because other apps expect it - this.fileInfo.dir = this.file.split('/').slice(0, -1).join('/') - - // DEPRECATED legacy views - // TODO: remove - this.views.forEach(view => { - view.setFileInfo(this.fileInfo) - }) - - this.$nextTick(() => { - if (this.$refs.tabs) { - this.$refs.tabs.updateTabs() - } - this.setActiveTab(this.Sidebar.activeTab || this.tabs[0].id) - }) - } catch (error) { - this.error = t('files', 'Error while loading the file data') - console.error('Error while loading the file data', error) + try { + this.fileInfo = await FileInfo(this.davPath) + // adding this as fallback because other apps expect it + this.fileInfo.dir = this.file.split('/').slice(0, -1).join('/') + + // DEPRECATED legacy views + // TODO: remove + this.views.forEach(view => { + view.setFileInfo(this.fileInfo) + }) - throw new Error(error) - } finally { - this.loading = false - } + this.$nextTick(() => { + if (this.$refs.tabs) { + this.$refs.tabs.updateTabs() + } + this.setActiveTab(this.Sidebar.activeTab || this.tabs[0].id) + }) + } catch (error) { + this.error = t('files', 'Error while loading the file data') + console.error('Error while loading the file data', error) + + throw new Error(error) + } finally { + this.loading = false } }, |