Skip to content

Conversation

fflorent
Copy link
Contributor

The problem

Fixes YunoHost/issues#2470

Solution

Escape ampersands (&) with \\& so it is treated as a special character. Quoting sed manpage:

s/regexp/replacement/
Attempt to match regexp against the pattern space. If successful, replace that portion matched with replacement. The replacement may contain the special character & to refer to that portion of
the pattern space which matched
, and the special escapes \1 through \9 to refer to the corresponding matching sub-expressions in the regexp.

PR Status

Ready to be reviewed, the test pass.

How to test

$ bash test_helpers.sh 2
$ bash test_helpers.sh 2.1

@alexAubin alexAubin changed the title files not templated correctly when values contain ampersands (&) #2470 helpers: fix ampersands (&) breaking file templating because it is a special sed char (issues#2470) Oct 12, 2025
@alexAubin alexAubin merged commit 9699340 into YunoHost:dev Oct 12, 2025
4 checks passed
@fflorent fflorent deleted the fix-ampersand-values-in-templates branch October 12, 2025 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Application Passwords are not correctly parsed probably because of & char

2 participants