From 645e330515019e023ca32de02db119cf004be788 Mon Sep 17 00:00:00 2001 From: Quentin Bellanger Date: Fri, 2 Feb 2024 10:45:21 +0100 Subject: [PATCH] =?UTF-8?q?Corrige=20le=20probl=C3=A8me=20des=20URL=20avec?= =?UTF-8?q?=20des=20espaces=20=C3=A0=20l'int=C3=A9rieur=20(#623)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * encode & decode pages url * add regex to validate url inputs * validate url fields in a11y statement * update changelog --- CHANGELOG.md | 4 ++++ .../src/components/audit/AuditGeneralInformationsForm.vue | 7 ++++--- confiture-web-app/src/components/ui/DsfrField.vue | 4 ++++ confiture-web-app/src/pages/audit/AuditDeclarationPage.vue | 6 +++++- confiture-web-app/src/utils.ts | 5 ++++- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c217a5f..c51137c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ Tous les changements notables de Ara sont documentĂ©s ici avec leur date, leur c ## 31/01/2024 +### Corrections 🐛 + +- EmpĂȘche la crĂ©ation de pages avec des espaces dans l’URL ([#623](https://github.com/DISIC/Ara/pull/623)) + ### Autres changements ⚙ - Corrige l’accessibilitĂ© de l’indicateur d’étape terminĂ©e sur la synthĂšse d’un audit ([#630](https://github.com/DISIC/Ara/pull/630)) diff --git a/confiture-web-app/src/components/audit/AuditGeneralInformationsForm.vue b/confiture-web-app/src/components/audit/AuditGeneralInformationsForm.vue index 85a92165..1326714c 100644 --- a/confiture-web-app/src/components/audit/AuditGeneralInformationsForm.vue +++ b/confiture-web-app/src/components/audit/AuditGeneralInformationsForm.vue @@ -7,7 +7,7 @@ import { useNotifications } from "../../composables/useNotifications"; import { usePreviousRoute } from "../../composables/usePreviousRoute"; import { useAccountStore } from "../../store/account"; import { AuditType, CreateAuditRequestData } from "../../types"; -import { formatEmail } from "../../utils"; +import { formatEmail, URL_REGEX } from "../../utils"; import AuditTypeRadio from "./AuditTypeRadio.vue"; import BackLink from "../ui/BackLink.vue"; import DsfrField from "../ui/DsfrField.vue"; @@ -209,8 +209,7 @@ function onSubmit() { emit("submit", { auditType: auditType.value!, procedureName: procedureName.value, - // remove leading/trailing whitespaces from urls, the browser validation might accept those our backend won't! - pages: pages.value.map((p) => ({ ...p, url: p.url.trim() })), + pages: pages.value.map((p) => ({ ...p, url: p.url })), auditorName: procedureAuditorName.value, auditorEmail: formatEmail(procedureAuditorEmail.value) }); @@ -359,6 +358,8 @@ const previousRoute = usePreviousRoute(); label="URL de la page" type="url" required + :pattern="URL_REGEX" + title="https://domaine.fr et sans espaces" @change="pagesArePristine = false" >