Skip to content

Commit

Permalink
Gestion des esperluettes dans les titres/noms de fichiers (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBruant authored Mar 25, 2024
1 parent c345420 commit fe485f0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
</div>
{:else}
<a
href="{atelierPrefix}?path={contenu.path}&repoName={repoName}&account={account}"
href="{atelierPrefix}?path={encodeURIComponent(contenu.path)}&repoName={repoName}&account={account}"
>
Modifier</a
>
Expand Down
2 changes: 1 addition & 1 deletion assets/scripts/routes/atelier-articles.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion assets/scripts/routes/atelier-pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion assets/scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('.')
Expand Down

0 comments on commit fe485f0

Please sign in to comment.