diff --git a/components/EditorNavigation.tsx b/components/EditorNavigation.tsx
index 270548d..9d32554 100644
--- a/components/EditorNavigation.tsx
+++ b/components/EditorNavigation.tsx
@@ -85,9 +85,16 @@ const EditorNavigation = ({ showWat }: { showWat?: boolean }) => {
const validateFilename = useCallback(
(filename: string): { error: string | null } => {
+ // check if filename already exists
if (snap.files.find(file => file.name === filename)) {
return { error: "Filename already exists." };
}
+
+ // check for illegal characters
+ const ILLEGAL_REGEX = /[/]/gi;
+ if (filename.match(ILLEGAL_REGEX)) {
+ return { error: "Filename contains illegal characters" };
+ }
// More checks in future
return { error: null };
},
@@ -216,10 +223,7 @@ const EditorNavigation = ({ showWat }: { showWat?: boolean }) => {
-