From b15ecd785e801c9553be4e05039b2609f3adf3da Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Sat, 1 Oct 2022 15:23:14 -0400 Subject: [PATCH] Fix trailing slash issue for base-url --- cmd/serve.go | 8 ++++++-- docs/releases.md | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cmd/serve.go b/cmd/serve.go index 23e50ac0..126cf0dc 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -157,14 +157,18 @@ func execServe(c *cli.Context) error { return errors.New("if smtp-server-listen is set, smtp-server-domain must also be set") } else if attachmentCacheDir != "" && baseURL == "" { return errors.New("if attachment-cache-dir is set, base-url must also be set") - } else if baseURL != "" && !strings.HasPrefix(baseURL, "http://") && !strings.HasPrefix(baseURL, "https://") && strings.HasSuffix(baseURL, "/") { - return errors.New("if set, base-url must start with http:// or https://, and must not end with a slash (/)") + } else if baseURL != "" && !strings.HasPrefix(baseURL, "http://") && !strings.HasPrefix(baseURL, "https://") { + return errors.New("if set, base-url must start with http:// or https://") + } else if baseURL != "" && strings.HasSuffix(baseURL, "/") { + return errors.New("if set, base-url must not end with a slash (/)") } else if !util.InStringList([]string{"read-write", "read-only", "write-only", "deny-all"}, authDefaultAccess) { return errors.New("if set, auth-default-access must start set to 'read-write', 'read-only', 'write-only' or 'deny-all'") } else if !util.InStringList([]string{"app", "home", "disable"}, webRoot) { return errors.New("if set, web-root must be 'home' or 'app'") } else if upstreamBaseURL != "" && !strings.HasPrefix(upstreamBaseURL, "http://") && !strings.HasPrefix(upstreamBaseURL, "https://") { return errors.New("if set, upstream-base-url must start with http:// or https://") + } else if upstreamBaseURL != "" && strings.HasSuffix(upstreamBaseURL, "/") { + return errors.New("if set, upstream-base-url must not end with a slash (/)") } else if upstreamBaseURL != "" && baseURL == "" { return errors.New("if upstream-base-url is set, base-url must also be set") } else if upstreamBaseURL != "" && baseURL != "" && baseURL == upstreamBaseURL { diff --git a/docs/releases.md b/docs/releases.md index 2afc07a3..bc63ae22 100644 --- a/docs/releases.md +++ b/docs/releases.md @@ -4,6 +4,10 @@ and the [ntfy Android app](https://github.com/binwiederhier/ntfy-android/release ## ntfy server v1.29.0 (UNRELEASED) +**Bug fixes:** + +* Subscriptions can now have a display name ([#370](https://github.com/binwiederhier/ntfy/issues/370), thanks to [@tfheen](https://github.com/tfheen) for reporting) + **Documentation:** * Updated developer docs, bump nodejs and go version ([#414](https://github.com/binwiederhier/ntfy/issues/414), thanks to [@YJSoft](https://github.com/YJSoft) for reporting)