mirror of
https://github.com/binwiederhier/ntfy.git
synced 2024-12-22 17:52:30 +01:00
Add RFC 2047 encoding support for tags
This commit is contained in:
parent
35eac5b9ad
commit
59a5077713
2 changed files with 6 additions and 0 deletions
|
@ -892,6 +892,9 @@ func (s *Server) parsePublishParams(r *http.Request, m *message) (cache bool, fi
|
||||||
return false, false, "", false, errHTTPBadRequestPriorityInvalid
|
return false, false, "", false, errHTTPBadRequestPriorityInvalid
|
||||||
}
|
}
|
||||||
m.Tags = readCommaSeparatedParam(r, "x-tags", "tags", "tag", "ta")
|
m.Tags = readCommaSeparatedParam(r, "x-tags", "tags", "tag", "ta")
|
||||||
|
for i, t := range m.Tags {
|
||||||
|
m.Tags[i] = maybeDecodeHeader(t)
|
||||||
|
}
|
||||||
delayStr := readParam(r, "x-delay", "delay", "x-at", "at", "x-in", "in")
|
delayStr := readParam(r, "x-delay", "delay", "x-at", "at", "x-in", "in")
|
||||||
if delayStr != "" {
|
if delayStr != "" {
|
||||||
if !cache {
|
if !cache {
|
||||||
|
|
|
@ -2474,12 +2474,15 @@ func TestServer_PublishWithUTF8MimeHeader(t *testing.T) {
|
||||||
"X-Filename": "some attachment.txt",
|
"X-Filename": "some attachment.txt",
|
||||||
"X-Message": "=?UTF-8?B?8J+HqfCfh6o=?=",
|
"X-Message": "=?UTF-8?B?8J+HqfCfh6o=?=",
|
||||||
"X-Title": "=?UTF-8?B?bnRmeSDlvojmo5I=?=, no really I mean it! =?UTF-8?Q?This is q=C3=BC=C3=B6ted-print=C3=A4ble.?=",
|
"X-Title": "=?UTF-8?B?bnRmeSDlvojmo5I=?=, no really I mean it! =?UTF-8?Q?This is q=C3=BC=C3=B6ted-print=C3=A4ble.?=",
|
||||||
|
"X-Tags": "=?UTF-8?B?8J+HqfCfh6o=?=, =?UTF-8?B?bnRmeSDlvojmo5I=?=",
|
||||||
})
|
})
|
||||||
require.Equal(t, 200, response.Code)
|
require.Equal(t, 200, response.Code)
|
||||||
m := toMessage(t, response.Body.String())
|
m := toMessage(t, response.Body.String())
|
||||||
require.Equal(t, "🇩🇪", m.Message)
|
require.Equal(t, "🇩🇪", m.Message)
|
||||||
require.Equal(t, "ntfy 很棒, no really I mean it! This is qüöted-printäble.", m.Title)
|
require.Equal(t, "ntfy 很棒, no really I mean it! This is qüöted-printäble.", m.Title)
|
||||||
require.Equal(t, "some attachment.txt", m.Attachment.Name)
|
require.Equal(t, "some attachment.txt", m.Attachment.Name)
|
||||||
|
require.Equal(t, "🇩🇪", m.Tags[0])
|
||||||
|
require.Equal(t, "ntfy 很棒", m.Tags[1])
|
||||||
}
|
}
|
||||||
|
|
||||||
func newTestConfig(t *testing.T) *Config {
|
func newTestConfig(t *testing.T) *Config {
|
||||||
|
|
Loading…
Reference in a new issue