diff --git a/.vscode/settings.json b/.vscode/settings.json index 5032ec7..85763c2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -25,7 +25,7 @@ "eslint.autoFixOnSave": true, "typescript.tsdk": ".yarn/sdks/typescript/lib", "editor.codeActionsOnSave": { - "source.fixAll.eslint": true + "source.fixAll.eslint": "explicit" }, "search.exclude": { "**/.yarn": true, diff --git a/imports/dashboard/files/fileList.tsx b/imports/dashboard/files/fileList.tsx index 30df89f..daa83c3 100644 --- a/imports/dashboard/files/fileList.tsx +++ b/imports/dashboard/files/fileList.tsx @@ -94,6 +94,10 @@ const FileListItemRenderer = ({ index, data, style }: ListChildComponentProps): .filter(e => !filesSelected.includes(e)) setFilesSelected([...filesSelected, ...filesToSelect]) } + const subpath = file.folder ? joinPath(path, file.name) : path + const params = new URLSearchParams() + if (router.query.node) params.append('node', router.query.node as string) + if (!file.folder) params.append('file', file.name) return ( e.shiftKey ? shiftClickItem() : selectItem()} - url={`/dashboard/${router.query.server}/files${file.folder ? joinPath(path, file.name) : path - }${typeof router.query.node === 'string' ? '?node=' + router.query.node : ''}`} + url={`/dashboard/${router.query.server}/files${subpath}${params.size ? '?' : ''}${params}`} /> ) } diff --git a/imports/dashboard/files/fileManager.tsx b/imports/dashboard/files/fileManager.tsx index 96c4428..7f03660 100644 --- a/imports/dashboard/files/fileManager.tsx +++ b/imports/dashboard/files/fileManager.tsx @@ -162,13 +162,13 @@ const FileManager = (props: { // When an editor is open, no actions can be performed, so this is not a problem. if (!files) return // Check if the file exists, and depending on its metadata, act accordingly. - const file = files.find(file => file.name === filename) - if (!file) { + const fileInf = files.find(f => f.name === filename) + if (!fileInf) { updatePath(path) // Remove file from path. return setMessage('The requested file does not exist!') } else if ( - file.size < 2 * 1024 * 1024 && - (editorExts.includes(filename.split('.').pop() ?? '') || file.mimeType.startsWith('text/')) + fileInf.size < 2 * 1024 * 1024 && + (editorExts.includes(filename.split('.').pop() ?? '') || fileInf.mimeType.startsWith('text/')) ) { loadFileInEditor(filename).catch(err => { console.error(err) diff --git a/package.json b/package.json index 26d14fa..10bdda1 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "author": "Ibrahim Ansari ", "license": "Apache-2.0", "private": true, - "packageManager": "yarn@4.0.0-rc.49", + "packageManager": "yarn@4.0.2", "scripts": { "test": "jest", "dev": "next",