Skip to content

Commit 5451e9c

Browse files
committed
Escaping ampersand characters
so they are not used as backreferences by sed Also enclosing the url in quotes so xinit does not parse the URL loading the rc file
1 parent 040acc0 commit 5451e9c

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)