mirror of
https://github.com/binwiederhier/ntfy.git
synced 2024-12-26 11:42:29 +01:00
Remove backslash from quoted strings
This commit is contained in:
parent
fb56ab9a06
commit
adea3c38be
2 changed files with 3 additions and 3 deletions
|
@ -251,7 +251,7 @@ func (p *actionParser) parseQuotedValue(quote rune) (value string, last bool, er
|
|||
err = fmt.Errorf("unexpected end of input, quote started at position %d", start)
|
||||
return
|
||||
} else if r == quote && prev != '\\' {
|
||||
value = p.input[start:p.pos]
|
||||
value = strings.ReplaceAll(p.input[start:p.pos], "\\"+string(quote), string(quote)) // \" -> "
|
||||
p.pos += w
|
||||
|
||||
// Advance until section end (after "," or ";")
|
||||
|
|
|
@ -67,7 +67,7 @@ func TestParseActions(t *testing.T) {
|
|||
require.Nil(t, err)
|
||||
require.Equal(t, 1, len(actions))
|
||||
require.Equal(t, "http", actions[0].Action)
|
||||
require.Equal(t, `Look ma, \"quotes\"; and semicolons`, actions[0].Label)
|
||||
require.Equal(t, `Look ma, "quotes"; and semicolons`, actions[0].Label)
|
||||
require.Equal(t, `http://example.com`, actions[0].URL)
|
||||
|
||||
// Single quotes
|
||||
|
@ -75,7 +75,7 @@ func TestParseActions(t *testing.T) {
|
|||
require.Nil(t, err)
|
||||
require.Equal(t, 1, len(actions))
|
||||
require.Equal(t, "http", actions[0].Action)
|
||||
require.Equal(t, `"quotes" and \'single quotes\'`, actions[0].Label)
|
||||
require.Equal(t, `"quotes" and 'single quotes'`, actions[0].Label)
|
||||
require.Equal(t, `http://example.com`, actions[0].URL)
|
||||
|
||||
// Single quotes (JSON)
|
||||
|
|
Loading…
Reference in a new issue