From fe485f0490e225bcf721e0cff35338df3dae6acd Mon Sep 17 00:00:00 2001 From: David Bruant Date: Mon, 25 Mar 2024 21:25:17 +0100 Subject: [PATCH] Gestion des esperluettes dans les titres/noms de fichiers (#193) --- assets/scripts/components/screens/intern/ListContenu.svelte | 2 +- assets/scripts/routes/atelier-articles.js | 2 +- assets/scripts/routes/atelier-pages.js | 2 +- assets/scripts/utils.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/assets/scripts/components/screens/intern/ListContenu.svelte b/assets/scripts/components/screens/intern/ListContenu.svelte index a8fd9d51..e97cde25 100644 --- a/assets/scripts/components/screens/intern/ListContenu.svelte +++ b/assets/scripts/components/screens/intern/ListContenu.svelte @@ -120,7 +120,7 @@ {:else} Modifier diff --git a/assets/scripts/routes/atelier-articles.js b/assets/scripts/routes/atelier-articles.js index 94d70305..0f1dd44e 100644 --- a/assets/scripts/routes/atelier-articles.js +++ b/assets/scripts/routes/atelier-articles.js @@ -86,7 +86,7 @@ export default async ({ querystring }) => { } const state = store.state - const fileName = new URLSearchParams(querystring).get('path') ?? '' + const fileName = decodeURIComponent(new URLSearchParams(querystring).get('path') ?? '') const mapStateToProps = makeMapStateToProps(fileName) const articleContenu = new ArticleContenu({ diff --git a/assets/scripts/routes/atelier-pages.js b/assets/scripts/routes/atelier-pages.js index 34ee07c1..0c023e5b 100644 --- a/assets/scripts/routes/atelier-pages.js +++ b/assets/scripts/routes/atelier-pages.js @@ -86,7 +86,7 @@ export default async ({ querystring }) => { await setCurrentRepositoryFromQuerystring(querystring) const state = store.state - const fileName = new URLSearchParams(querystring).get('path') ?? '' + const fileName = decodeURIComponent(new URLSearchParams(querystring).get('path') ?? '') const mapStateToProps = makeMapStateToProps(fileName) const currentRepository = store.state.currentRepository diff --git a/assets/scripts/utils.js b/assets/scripts/utils.js index 41dd88e3..0f1fceac 100644 --- a/assets/scripts/utils.js +++ b/assets/scripts/utils.js @@ -45,7 +45,7 @@ export const handleErrors = errorMessage => { */ function makeFilenameCompatibleString(string) { return string - .replace(/\/|#|\?|:/g, '-') // replace url confusing characters + .replace(/\/|#|\?|:|&|\(|\)/g, '-') // replace url confusing characters .normalize('NFD') .replace(/[\u0300-\u036f]/g, '') // remove accent because GH pages triggers file download .split('.')