From c05cf5b033bf07c166f538141b40683f75c71f78 Mon Sep 17 00:00:00 2001 From: Tsilavina Razafinirina Date: Sat, 25 May 2019 22:47:06 +0300 Subject: [PATCH] [MM-11287] Add support for plus sign and period/dot in custom URL schemes (#9155) (#10852) --- model/config.go | 2 +- model/config_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/model/config.go b/model/config.go index 5f80afe8c5..891a297305 100644 --- a/model/config.go +++ b/model/config.go @@ -2871,7 +2871,7 @@ func (mes *MessageExportSettings) isValid(fs FileSettings) *AppError { func (ds *DisplaySettings) isValid() *AppError { if len(ds.CustomUrlSchemes) != 0 { - validProtocolPattern := regexp.MustCompile(`(?i)^\s*[a-z][a-z0-9-]*\s*$`) + validProtocolPattern := regexp.MustCompile(`(?i)^\s*[A-Za-z][A-Za-z0-9.+-]*\s*$`) for _, scheme := range ds.CustomUrlSchemes { if !validProtocolPattern.MatchString(scheme) { diff --git a/model/config_test.go b/model/config_test.go index 187edf3d31..9ea287f00b 100644 --- a/model/config_test.go +++ b/model/config_test.go @@ -509,7 +509,7 @@ func TestDisplaySettingsIsValidCustomUrlSchemes(t *testing.T) { { name: "containing period", value: []string{"iris.beep"}, - valid: false, // should technically be true, but client doesn't support it + valid: true, }, { name: "containing hyphen", @@ -519,7 +519,7 @@ func TestDisplaySettingsIsValidCustomUrlSchemes(t *testing.T) { { name: "containing plus", value: []string{"coap+tcp", "coap+ws"}, - valid: false, // should technically be true, but client doesn't support it + valid: true, }, { name: "starting with number",