Skip to content

Commit b1a5136

Browse files
authored
Merge pull request #5 from quinkennedy/escape-amp
Escaping ampersand characters
2 parents 040acc0 + 5451e9c commit b1a5136

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

extension.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ function _replaceTokens(filePath, tokens) {
4040
function replace(token, value) {
4141
// tokens start with a $ which needs to be escaped, oops
4242
var _token = '\\' + token,
43+
// any '&' character needs to be escaped in the value,
44+
// otherwise it is used as a backreference
45+
_value = value.replace(/&/g, '\\&'),
4346
// use commas as delims so that we don't need to escape value, which might be a URL
44-
cmd = 'sed -i "s,' + _token + ',' + value + ',g" ' + filePath;
47+
cmd = 'sed -i "s,' + _token + ',' + _value + ',g" ' + filePath;
4548
execSync(cmd);
4649
}
4750

scripts/.xinitrc.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ xset s noblank
66

77
unclutter -idle 0.1 &
88

9-
exec /usr/bin/chromium --noerrdialogs --kiosk --incognito $url
9+
exec /usr/bin/chromium --noerrdialogs --kiosk --incognito "$url"

0 commit comments

Comments
 (0)