Skip to content

Commit 37f2b52

Browse files
authored
Reverted changes to the way discord webhook URL is parsed
1 parent d6af534 commit 37f2b52

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

pkg/notifications/notifier_test.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,9 @@ var _ = Describe("notifications", func() {
169169
hookURL := fmt.Sprintf("https://%s/api/webhooks/%s/%s/slack", "discordapp.com", channel, token)
170170
testURL(buildArgs(hookURL), expected, time.Duration(0))
171171
})
172-
It("should return a discord url when using a hook url with no trailing path arguments", func() {
173-
hookURL := fmt.Sprintf("https://%s/api/webhooks/%s/%s", "discord.com", channel, token)
174-
testURL(buildArgs(hookURL), expected, time.Duration(0))
175-
})
176172
When("icon URL and username are specified", func() {
177173
It("should return the expected URL", func() {
178-
hookURL := fmt.Sprintf("https://%s/api/webhooks/%s/%s", "discord.com", channel, token)
174+
hookURL := fmt.Sprintf("https://%s/api/webhooks/%s/%s/slack", "discord.com", channel, token)
179175
expectedOutput := fmt.Sprintf("discord://%s@%s?avatar=%s&color=0x%x&colordebug=0x0&colorerror=0x0&colorinfo=0x0&colorwarn=0x0&title=%s&username=%s", token, channel, url.QueryEscape(iconURL), color, title, username)
180176
expectedDelay := time.Duration(7) * time.Second
181177
args := []string{

pkg/notifications/slack.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ func (s *slackTypeNotifier) GetURL(c *cobra.Command, title string) (string, erro
4949
if parts[0] == "discord.com" || parts[0] == "discordapp.com" {
5050
log.Debug("Detected a discord slack wrapper URL, using shoutrrr discord service")
5151
conf := &shoutrrrDisco.Config{
52-
WebhookID: parts[3],
53-
Token: parts[4],
52+
WebhookID: parts[len(parts)-3],
53+
Token: parts[len(parts)-2],
5454
Color: ColorInt,
5555
Title: title,
5656
SplitLines: true,

0 commit comments

Comments
 (0)