Skip to content
This repository was archived by the owner on Jan 27, 2025. It is now read-only.

Commit 4d4c8ec

Browse files
committed
Add backslash invalid character check to base-file
1 parent 8550b8f commit 4d4c8ec

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/base-file.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,14 @@ class BaseFile extends React.Component {
108108
// })
109109
return
110110
}
111-
if (newName.indexOf('/') !== -1) {
112-
// todo: move to props handler
113-
// window.notify({
114-
// style: 'error',
115-
// title: 'Invalid new file name',
116-
// body: 'File names cannot contain forward slashes.',
117-
// })
118-
return
119-
}
111+
const invalidChar = ['/', '\\']
112+
if (invalidChar.some(char => newName.indexOf(char) !== -1)) return
113+
// todo: move to props handler
114+
// window.notify({
115+
// style: 'error',
116+
// title: 'Invalid new file name',
117+
// body: 'File names cannot contain forward slashes.',
118+
// })
120119
let newKey = newName
121120
const slashIndex = this.props.fileKey.lastIndexOf('/')
122121
if (slashIndex !== -1) {

0 commit comments

Comments
 (0)