Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/files/src/actions/openFolderAction.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ describe('Open folder action execute tests', () => {
// Silent action
expect(exec).toBe(null)
expect(goToRouteMock).toBeCalledTimes(1)
expect(goToRouteMock).toBeCalledWith(null, { fileid: undefined, view: 'files' }, { dir: '/FooBar' })
expect(goToRouteMock).toBeCalledWith(null, { fileid: 1, view: 'files' }, { dir: '/FooBar' })
})

test('Open folder fails without node', async () => {
Expand Down
4 changes: 2 additions & 2 deletions apps/files/src/actions/openFolderAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ export const action = new FileAction({

window.OCP.Files.Router.goToRoute(
null,
{ view: view.id, fileid: undefined },
{ dir: join(dir, node.basename), fileid: undefined },
{ view: view.id, fileid: node.fileid },
{ dir: join(dir, node.basename) },
)
return null
},
Expand Down
3 changes: 2 additions & 1 deletion apps/files/src/components/BreadCrumbs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ export default Vue.extend({

sections() {
return this.dirs.map(dir => {
const to = { ...this.$route, query: { dir } }
const fileid = this.getFileIdFromPath(dir)
const to = { ...this.$route, params: { fileid }, query: { dir } }
return {
dir,
exact: true,
Expand Down
11 changes: 8 additions & 3 deletions apps/files/src/components/FilesListVirtual.vue
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,21 @@ export default Vue.extend({
// Scroll to the file if it's in the url
if (this.fileId) {
const index = this.nodes.findIndex(node => node.fileid === this.fileId)
if (index === -1) {
if (index === -1 && this.fileId !== this.currentFolder.fileid) {
showError(this.t('files', 'File not found'))
}
this.scrollToIndex = Math.max(0, index)
}

// Open the file sidebar if we have the room for it
if (document.documentElement.clientWidth > 1024) {
// Open the sidebar on the file if it's in the url and
// we're just loaded the app for the first time.
// Don't open the sidebar for the current folder
if (this.currentFolder.fileid === this.fileId) {
return
}

// Open the sidebar for the given URL fileid
// iif we just loaded the app.
const node = this.nodes.find(n => n.fileid === this.fileId) as Node
if (node && sidebarAction?.enabled?.([node], this.currentView)) {
logger.debug('Opening sidebar on file ' + node.path, { node })
Expand Down
4 changes: 2 additions & 2 deletions dist/files-init.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-init.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/files-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-main.js.map

Large diffs are not rendered by default.