AlbumForm: disallow slash in name (fix #442)

pull/460/head
Varun Patil 2023-03-03 09:35:59 -08:00
parent 4bbf8770b7
commit a6eccd6a23
1 changed files with 15 additions and 1 deletions

View File

@ -99,9 +99,11 @@
import { defineComponent, PropType } from "vue"; import { defineComponent, PropType } from "vue";
import { getCurrentUser } from "@nextcloud/auth"; import { getCurrentUser } from "@nextcloud/auth";
import { showError } from "@nextcloud/dialogs";
import NcButton from "@nextcloud/vue/dist/Components/NcButton"; import NcButton from "@nextcloud/vue/dist/Components/NcButton";
import NcLoadingIcon from "@nextcloud/vue/dist/Components/NcLoadingIcon"; import NcLoadingIcon from "@nextcloud/vue/dist/Components/NcLoadingIcon";
const NcTextField = () => import("@nextcloud/vue/dist/Components/NcTextField"); const NcTextField = () => import("@nextcloud/vue/dist/Components/NcTextField");
import moment from "moment"; import moment from "moment";
import * as dav from "../../services/DavRequests"; import * as dav from "../../services/DavRequests";
@ -178,6 +180,18 @@ export default defineComponent({
if (this.albumName === "" || this.loading) { if (this.albumName === "" || this.loading) {
return; return;
} }
// Validate the album name, it shouldn't contain any slash
if (this.albumName.includes("/")) {
showError(
this.t(
"memories",
"Invalid album name; should not contain any slashes."
)
);
return;
}
if (this.editMode) { if (this.editMode) {
this.handleUpdateAlbum(); this.handleUpdateAlbum();
} else { } else {
@ -287,4 +301,4 @@ export default defineComponent({
.left-buttons { .left-buttons {
flex-grow: 1; flex-grow: 1;
} }
</style> </style>