File tree Expand file tree Collapse file tree
apps/files_external/lib/Lib/Storage Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -169,13 +169,21 @@ protected function getFileInfo(string $path): IFileInfo {
169169 }
170170 } catch (ConnectException $ e ) {
171171 $ this ->throwUnavailable ($ e );
172+ } catch (InvalidArgumentException $ e ) {
173+ $ this ->throwUnavailable ($ e );
172174 } catch (NotFoundException $ e ) {
173175 throw new \OCP \Files \NotFoundException ($ e ->getMessage (), 0 , $ e );
174176 } catch (ForbiddenException $ e ) {
175177 // with php-smbclient, this exception is thrown when the provided password is invalid.
176- // Possible is also ForbiddenException with a different error code, so we check it.
177- if ($ e -> getCode () === 1 ) {
178+ // we check if we can stat the root, which should only fail in authentication failures
179+ if ($ path === '' ) {
178180 $ this ->throwUnavailable ($ e );
181+ } else {
182+ try {
183+ $ this ->share ->stat ('' );
184+ } catch (\Exception $ e ) {
185+ $ this ->throwUnavailable ($ e );
186+ }
179187 }
180188 throw new \OCP \Files \ForbiddenException ($ e ->getMessage (), false , $ e );
181189 }
You can’t perform that action at this time.
0 commit comments