From c38d37e0c8aea3e718205fe99f5f3ca0d3e72d74 Mon Sep 17 00:00:00 2001 From: controlol Date: Wed, 3 Nov 2021 21:01:12 +0100 Subject: [PATCH] updatePath can only be called by a dir now --- src/components/fileBrowser.jsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/fileBrowser.jsx b/src/components/fileBrowser.jsx index f81e4f5..454c604 100644 --- a/src/components/fileBrowser.jsx +++ b/src/components/fileBrowser.jsx @@ -300,13 +300,13 @@ class FileBrowser extends Component { } // after the user clicks on a folder - updatePath = (isDir, name) => { - if (isDir && !(this.props.menuOpen || this.state.showMenu)) { - const newPath = path.join(this.props.currentPath, name) + updatePath = name => { + if (this.props.menuOpen || this.state.showMenu) return; - this.props.updateFiles(newPath) - this.setState({filter: ""}) - } + const newPath = path.join(this.props.currentPath, name) + + this.props.updateFiles(newPath) + this.setState({filter: ""}) } // after the user clicks on the back button @@ -413,7 +413,7 @@ class FileBrowser extends Component { { this.renderImage(v.MimeType, v.Name) } { v.IsDir ? - this.updatePath(v.IsDir, v.Name)} onContextMenu={this.openMenu}>{ v.Name } + this.updatePath(v.Name)} onContextMenu={this.openMenu}>{ v.Name } : { v.Name } }