Skip to content

Commit b9f3b13

Browse files
committed
Find relative path
1 parent 306192e commit b9f3b13

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

apps/remix-ide/src/app/files/fileManager.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const globalRegistry = require('../../global/registry')
99
const toaster = require('../ui/tooltip')
1010
const modalDialogCustom = require('../ui/modal-dialog-custom')
1111
const helper = require('../../lib/helper.js')
12+
const path = require('path')
1213

1314
/*
1415
attach to files event (removed renamed)
@@ -58,7 +59,14 @@ class FileManager extends Plugin {
5859
}
5960

6061
limitPluginScope (path) {
61-
return path.replace(/^\/browser\//, '').replace(/^browser\//, '') // forbids plugin to access the root filesystem
62+
const workspace = this.fileManager.currentWorkspace()
63+
64+
if (workspace) {
65+
66+
} else {
67+
68+
}
69+
6270
}
6371

6472
/**

libs/remix-ui/file-explorer/src/lib/file-explorer.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
314314
const createNewFile = (newFilePath: string) => {
315315
const fileManager = state.fileManager
316316

317+
if (helper.checkSpecialChars(newFilePath) || helper.checkSlash(newFilePath)) return toast('special characters are not allowed')
317318
helper.createNonClashingName(newFilePath, filesProvider, async (error, newName) => {
318319
if (error) {
319320
modal('Create File Failed', error, {
@@ -392,6 +393,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
392393
fn: () => {}
393394
}, null)
394395
} else {
396+
if (helper.checkSpecialChars(newPath) || helper.checkSlash(newPath)) throw new Error('special characters are not allowed')
395397
await fileManager.rename(oldPath, newPath)
396398
}
397399
} catch (error) {

0 commit comments

Comments
 (0)