From 2a16a9d403d294a8cecb2e5201909ba314b896ae Mon Sep 17 00:00:00 2001 From: zurdi Date: Sat, 19 Aug 2023 00:14:44 +0200 Subject: [PATCH] slash not allowd in file name when editing --- frontend/src/components/Dialog/EditRom.vue | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/Dialog/EditRom.vue b/frontend/src/components/Dialog/EditRom.vue index 3317d9e9a..df2c396d8 100644 --- a/frontend/src/components/Dialog/EditRom.vue +++ b/frontend/src/components/Dialog/EditRom.vue @@ -7,6 +7,10 @@ const { xs, mdAndDown, lgAndUp } = useDisplay(); const show = ref(false); const rom = ref(); const renameAsIGDB = ref(false); +const inputRules = { + required: (value) => !!value || "Required.", + newFileName: (value) => !value.includes("/") || "Invalid characters", +}; const emitter = inject("emitter"); emitter.on("showEditDialog", (romToEdit) => { @@ -15,6 +19,16 @@ emitter.on("showEditDialog", (romToEdit) => { }); async function updateRom(updatedData = { ...rom.value }) { + + if (updatedData.file_name.includes("/")) { + emitter.emit("snackbarShow", { + msg: "Couldn't edit rom: invalid file name characters", + icon: "mdi-close-circle", + color: "red", + }); + return; + } + show.value = false; emitter.emit("showLoadingDialog", { loading: true, scrim: true }); @@ -93,6 +107,7 @@ async function updateRom(updatedData = { ...rom.value }) { Cancel - Apply + Apply