diff --git a/src/components/MenuBar.vue b/src/components/MenuBar.vue index d78922172da..fb047f471e9 100644 --- a/src/components/MenuBar.vue +++ b/src/components/MenuBar.vue @@ -450,7 +450,7 @@ export default { href, }) }) - }, false, [], true, undefined, this.linkPath) + }, false, [], true, undefined, this.linkPath, { allowDirectoryChooser: true }) }, optimalPathTo(targetFile) { const absolutePath = targetFile.split('/') diff --git a/src/components/MenuBubble.vue b/src/components/MenuBubble.vue index 472e62a224d..caf0b92cb23 100644 --- a/src/components/MenuBubble.vue +++ b/src/components/MenuBubble.vue @@ -151,10 +151,14 @@ export default { client.getFileInfo(file).then((_status, fileInfo) => { const path = optimalPath(this.filePath, `${fileInfo.path}/${fileInfo.name}`) const encodedPath = path.split('/').map(encodeURIComponent).join('/') - command({ href: `${encodedPath}?fileId=${fileInfo.id}` }) + if (fileInfo.mimetype === 'httpd/unix-directory') { + command({ href: `${encodedPath}/?fileId=${fileInfo.id}` }) + } else { + command({ href: `${encodedPath}?fileId=${fileInfo.id}` }) + } this.hideLinkMenu() }) - }, false, [], true, undefined, startPath) + }, false, [], true, undefined, startPath, { allowDirectoryChooser: true }) }, setLinkUrl(command, url) { // Heuristics for determining if we need a https:// prefix. diff --git a/src/helpers/links.js b/src/helpers/links.js index 18f556b5c99..a423a678950 100644 --- a/src/helpers/links.js +++ b/src/helpers/links.js @@ -59,8 +59,13 @@ const domHref = function(node) { if (match) { const [, relPath, id] = match const currentDir = basedir(OCA.Viewer.file) - const dir = absolutePath(currentDir, basedir(relPath)) - return generateUrl(`/apps/files/?dir=${dir}&openfile=${id}#relPath=${relPath}`) + if (relPath.slice(-1) === '/') { + const dir = absolutePath(currentDir, relPath) + return generateUrl(`/apps/files/?dir=${dir}&openfile=${id}`) + } else { + const dir = absolutePath(currentDir, basedir(relPath)) + return generateUrl(`/apps/files/?dir=${dir}&openfile=${id}#relPath=${relPath}`) + } } }