diff --git a/frontend/src/components/prompts/Rename.vue b/frontend/src/components/prompts/Rename.vue
index f18ed7a0..5c4362e4 100644
--- a/frontend/src/components/prompts/Rename.vue
+++ b/frontend/src/components/prompts/Rename.vue
@@ -16,6 +16,9 @@
@keyup.enter="submit"
v-model.trim="name"
/>
+
+ {{ $t("errors.invalidFileName") }}
+
@@ -31,6 +34,7 @@
@click="submit"
class="button button--flat"
type="submit"
+ :disabled="!isValidName"
:aria-label="$t('buttons.rename')"
:title="$t('buttons.rename')"
>
@@ -48,6 +52,8 @@ import url from "@/utils/url";
import { files as api } from "@/api";
import { removePrefix } from "@/api/utils";
+const INVALID_CHARACTERS = ["/"];
+
export default {
name: "rename",
data: function () {
@@ -67,6 +73,9 @@ export default {
"isListing",
]),
...mapWritableState(useFileStore, ["reload", "preselect"]),
+ isValidName() {
+ return !INVALID_CHARACTERS.some((char) => this.name.includes(char));
+ },
},
methods: {
...mapActions(useLayoutStore, ["closeHovers"]),
@@ -117,3 +126,9 @@ export default {
},
};
+
diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json
index 9411d91e..02afbf6d 100644
--- a/frontend/src/i18n/en.json
+++ b/frontend/src/i18n/en.json
@@ -57,7 +57,8 @@
"forbidden": "You don't have permissions to access this.",
"internal": "Something really went wrong.",
"notFound": "This location can't be reached.",
- "connection": "The server can't be reached."
+ "connection": "The server can't be reached.",
+ "invalidFileName": "The file or directory name is not valid."
},
"files": {
"body": "Body",