core/desktopentry: handle string escape sequences
This commit is contained in:
parent
3e2ce40b18
commit
1b147a2c78
2 changed files with 13 additions and 6 deletions
|
|
@ -22,3 +22,4 @@ set shell id.
|
|||
## Bug Fixes
|
||||
|
||||
- Fixed volume control breaking with pipewire pro audio mode.
|
||||
- Fixed escape sequence handling in desktop entries.
|
||||
|
|
|
|||
|
|
@ -269,16 +269,22 @@ QVector<QString> DesktopEntry::parseExecString(const QString& execString) {
|
|||
currentArgument += '\\';
|
||||
escape = 0;
|
||||
}
|
||||
} else if (escape == 2) {
|
||||
currentArgument += c;
|
||||
escape = 0;
|
||||
} else if (escape != 0) {
|
||||
if (escape != 2) {
|
||||
// Technically this is an illegal state, but the spec has a terrible double escape
|
||||
// rule in strings for no discernable reason. Assuming someone might understandably
|
||||
// misunderstand it, treat it as a normal escape and log it.
|
||||
switch (c.unicode()) {
|
||||
case 's': currentArgument += u' '; break;
|
||||
case 'n': currentArgument += u'\n'; break;
|
||||
case 't': currentArgument += u'\t'; break;
|
||||
case 'r': currentArgument += u'\r'; break;
|
||||
case '\\': currentArgument += u'\\'; break;
|
||||
default:
|
||||
qCWarning(logDesktopEntry).noquote()
|
||||
<< "Illegal escape sequence in desktop entry exec string:" << execString;
|
||||
currentArgument += c;
|
||||
break;
|
||||
}
|
||||
|
||||
currentArgument += c;
|
||||
escape = 0;
|
||||
} else if (c == u'"' || c == u'\'') {
|
||||
parsingString = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue