[MM-37772] Idiomatic naming (URL, URI, API) (#18128)
* s/Url/URL/g & s/Uri/URI/g * s/Api/API/g
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
a7f5512ff3
Коммит
757dc96461
140
model/config.go
140
model/config.go
@@ -99,7 +99,7 @@ const (
|
||||
|
||||
SitenameMaxLength = 30
|
||||
|
||||
ServiceSettingsDefaultSiteUrl = "http://localhost:8065"
|
||||
ServiceSettingsDefaultSiteURL = "http://localhost:8065"
|
||||
ServiceSettingsDefaultTLSCertFile = ""
|
||||
ServiceSettingsDefaultTLSKeyFile = ""
|
||||
ServiceSettingsDefaultReadTimeout = 300
|
||||
@@ -108,8 +108,8 @@ const (
|
||||
ServiceSettingsDefaultMaxLoginAttempts = 10
|
||||
ServiceSettingsDefaultAllowCorsFrom = ""
|
||||
ServiceSettingsDefaultListenAndAddress = ":8065"
|
||||
ServiceSettingsDefaultGfycatApiKey = "2_KtH_W5"
|
||||
ServiceSettingsDefaultGfycatApiSecret = "3wLVZPiswc3DnaiaFoLkDvB4X0IV6CpMkj4tf2inJRsBY6-FnkT08zGmppWFgeof"
|
||||
ServiceSettingsDefaultGfycatAPIKey = "2_KtH_W5"
|
||||
ServiceSettingsDefaultGfycatAPISecret = "3wLVZPiswc3DnaiaFoLkDvB4X0IV6CpMkj4tf2inJRsBY6-FnkT08zGmppWFgeof"
|
||||
|
||||
TeamSettingsDefaultSiteName = "Mattermost"
|
||||
TeamSettingsDefaultMaxUsersPerTeam = 50
|
||||
@@ -179,12 +179,12 @@ const (
|
||||
|
||||
AnnouncementSettingsDefaultBannerColor = "#f2a93b"
|
||||
AnnouncementSettingsDefaultBannerTextColor = "#333333"
|
||||
AnnouncementSettingsDefaultNoticesJsonUrl = "https://notices.mattermost.com/"
|
||||
AnnouncementSettingsDefaultNoticesJsonURL = "https://notices.mattermost.com/"
|
||||
AnnouncementSettingsDefaultNoticesFetchFrequencySeconds = 3600
|
||||
|
||||
TeamSettingsDefaultTeamText = "default"
|
||||
|
||||
ElasticsearchSettingsDefaultConnectionUrl = "http://localhost:9200"
|
||||
ElasticsearchSettingsDefaultConnectionURL = "http://localhost:9200"
|
||||
ElasticsearchSettingsDefaultUsername = "elastic"
|
||||
ElasticsearchSettingsDefaultPassword = "changeme"
|
||||
ElasticsearchSettingsDefaultPostIndexReplicas = 1
|
||||
@@ -211,8 +211,8 @@ const (
|
||||
PluginSettingsDefaultDirectory = "./plugins"
|
||||
PluginSettingsDefaultClientDirectory = "./client/plugins"
|
||||
PluginSettingsDefaultEnableMarketplace = true
|
||||
PluginSettingsDefaultMarketplaceUrl = "https://api.integrations.mattermost.com"
|
||||
PluginSettingsOldMarketplaceUrl = "https://marketplace.integrations.mattermost.com"
|
||||
PluginSettingsDefaultMarketplaceURL = "https://api.integrations.mattermost.com"
|
||||
PluginSettingsOldMarketplaceURL = "https://marketplace.integrations.mattermost.com"
|
||||
|
||||
ComplianceExportTypeCsv = "csv"
|
||||
ComplianceExportTypeActiance = "actiance"
|
||||
@@ -230,15 +230,15 @@ const (
|
||||
GoogleSettingsDefaultScope = "profile email"
|
||||
GoogleSettingsDefaultAuthEndpoint = "https://accounts.google.com/o/oauth2/v2/auth"
|
||||
GoogleSettingsDefaultTokenEndpoint = "https://www.googleapis.com/oauth2/v4/token"
|
||||
GoogleSettingsDefaultUserApiEndpoint = "https://people.googleapis.com/v1/people/me?personFields=names,emailAddresses,nicknames,metadata"
|
||||
GoogleSettingsDefaultUserAPIEndpoint = "https://people.googleapis.com/v1/people/me?personFields=names,emailAddresses,nicknames,metadata"
|
||||
|
||||
Office365SettingsDefaultScope = "User.Read"
|
||||
Office365SettingsDefaultAuthEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize"
|
||||
Office365SettingsDefaultTokenEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/token"
|
||||
Office365SettingsDefaultUserApiEndpoint = "https://graph.microsoft.com/v1.0/me"
|
||||
Office365SettingsDefaultUserAPIEndpoint = "https://graph.microsoft.com/v1.0/me"
|
||||
|
||||
CloudSettingsDefaultCwsUrl = "https://customers.mattermost.com"
|
||||
CloudSettingsDefaultCwsApiUrl = "https://portal.internal.prod.cloud.mattermost.com"
|
||||
CloudSettingsDefaultCwsURL = "https://customers.mattermost.com"
|
||||
CloudSettingsDefaultCwsAPIURL = "https://portal.internal.prod.cloud.mattermost.com"
|
||||
OpenidSettingsDefaultScope = "profile openid email"
|
||||
|
||||
LocalModeSocketPath = "/var/tmp/mattermost_local.socket"
|
||||
@@ -329,8 +329,8 @@ type ServiceSettings struct {
|
||||
WebsocketPort *int `access:"write_restrictable,cloud_restrictable"` // telemetry: none
|
||||
WebserverMode *string `access:"environment_web_server,write_restrictable,cloud_restrictable"`
|
||||
EnableGifPicker *bool `access:"integrations_gif"`
|
||||
GfycatApiKey *string `access:"integrations_gif"`
|
||||
GfycatApiSecret *string `access:"integrations_gif"`
|
||||
GfycatAPIKey *string `access:"integrations_gif"`
|
||||
GfycatAPISecret *string `access:"integrations_gif"`
|
||||
EnableCustomEmoji *bool `access:"site_emoji"`
|
||||
EnableEmojiPicker *bool `access:"site_emoji"`
|
||||
DEPRECATED_DO_NOT_USE_RestrictCustomEmojiCreation *string `json:"RestrictCustomEmojiCreation" mapstructure:"RestrictCustomEmojiCreation"` // Deprecated: do not use
|
||||
@@ -392,7 +392,7 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) {
|
||||
|
||||
if s.SiteURL == nil {
|
||||
if s.EnableDeveloper != nil && *s.EnableDeveloper {
|
||||
s.SiteURL = NewString(ServiceSettingsDefaultSiteUrl)
|
||||
s.SiteURL = NewString(ServiceSettingsDefaultSiteURL)
|
||||
} else {
|
||||
s.SiteURL = NewString("")
|
||||
}
|
||||
@@ -683,12 +683,12 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) {
|
||||
s.EnableGifPicker = NewBool(true)
|
||||
}
|
||||
|
||||
if s.GfycatApiKey == nil || *s.GfycatApiKey == "" {
|
||||
s.GfycatApiKey = NewString(ServiceSettingsDefaultGfycatApiKey)
|
||||
if s.GfycatAPIKey == nil || *s.GfycatAPIKey == "" {
|
||||
s.GfycatAPIKey = NewString(ServiceSettingsDefaultGfycatAPIKey)
|
||||
}
|
||||
|
||||
if s.GfycatApiSecret == nil || *s.GfycatApiSecret == "" {
|
||||
s.GfycatApiSecret = NewString(ServiceSettingsDefaultGfycatApiSecret)
|
||||
if s.GfycatAPISecret == nil || *s.GfycatAPISecret == "" {
|
||||
s.GfycatAPISecret = NewString(ServiceSettingsDefaultGfycatAPISecret)
|
||||
}
|
||||
|
||||
if s.DEPRECATED_DO_NOT_USE_RestrictCustomEmojiCreation == nil {
|
||||
@@ -1015,13 +1015,13 @@ type SSOSettings struct {
|
||||
Scope *string `access:"authentication_openid"` // telemetry: none
|
||||
AuthEndpoint *string `access:"authentication_openid"` // telemetry: none
|
||||
TokenEndpoint *string `access:"authentication_openid"` // telemetry: none
|
||||
UserApiEndpoint *string `access:"authentication_openid"` // telemetry: none
|
||||
UserAPIEndpoint *string `access:"authentication_openid"` // telemetry: none
|
||||
DiscoveryEndpoint *string `access:"authentication_openid"` // telemetry: none
|
||||
ButtonText *string `access:"authentication_openid"` // telemetry: none
|
||||
ButtonColor *string `access:"authentication_openid"` // telemetry: none
|
||||
}
|
||||
|
||||
func (s *SSOSettings) setDefaults(scope, authEndpoint, tokenEndpoint, userApiEndpoint, buttonColor string) {
|
||||
func (s *SSOSettings) setDefaults(scope, authEndpoint, tokenEndpoint, userAPIEndpoint, buttonColor string) {
|
||||
if s.Enable == nil {
|
||||
s.Enable = NewBool(false)
|
||||
}
|
||||
@@ -1050,8 +1050,8 @@ func (s *SSOSettings) setDefaults(scope, authEndpoint, tokenEndpoint, userApiEnd
|
||||
s.TokenEndpoint = NewString(tokenEndpoint)
|
||||
}
|
||||
|
||||
if s.UserApiEndpoint == nil {
|
||||
s.UserApiEndpoint = NewString(userApiEndpoint)
|
||||
if s.UserAPIEndpoint == nil {
|
||||
s.UserAPIEndpoint = NewString(userAPIEndpoint)
|
||||
}
|
||||
|
||||
if s.ButtonText == nil {
|
||||
@@ -1070,7 +1070,7 @@ type Office365Settings struct {
|
||||
Scope *string `access:"authentication_openid"`
|
||||
AuthEndpoint *string `access:"authentication_openid"` // telemetry: none
|
||||
TokenEndpoint *string `access:"authentication_openid"` // telemetry: none
|
||||
UserApiEndpoint *string `access:"authentication_openid"` // telemetry: none
|
||||
UserAPIEndpoint *string `access:"authentication_openid"` // telemetry: none
|
||||
DiscoveryEndpoint *string `access:"authentication_openid"` // telemetry: none
|
||||
DirectoryId *string `access:"authentication_openid"` // telemetry: none
|
||||
}
|
||||
@@ -1104,8 +1104,8 @@ func (s *Office365Settings) setDefaults() {
|
||||
s.TokenEndpoint = NewString(Office365SettingsDefaultTokenEndpoint)
|
||||
}
|
||||
|
||||
if s.UserApiEndpoint == nil {
|
||||
s.UserApiEndpoint = NewString(Office365SettingsDefaultUserApiEndpoint)
|
||||
if s.UserAPIEndpoint == nil {
|
||||
s.UserAPIEndpoint = NewString(Office365SettingsDefaultUserAPIEndpoint)
|
||||
}
|
||||
|
||||
if s.DirectoryId == nil {
|
||||
@@ -1122,7 +1122,7 @@ func (s *Office365Settings) SSOSettings() *SSOSettings {
|
||||
ssoSettings.DiscoveryEndpoint = s.DiscoveryEndpoint
|
||||
ssoSettings.AuthEndpoint = s.AuthEndpoint
|
||||
ssoSettings.TokenEndpoint = s.TokenEndpoint
|
||||
ssoSettings.UserApiEndpoint = s.UserApiEndpoint
|
||||
ssoSettings.UserAPIEndpoint = s.UserAPIEndpoint
|
||||
return &ssoSettings
|
||||
}
|
||||
|
||||
@@ -1882,7 +1882,7 @@ func (s *AnnouncementSettings) SetDefaults() {
|
||||
s.UserNoticesEnabled = NewBool(true)
|
||||
}
|
||||
if s.NoticesURL == nil {
|
||||
s.NoticesURL = NewString(AnnouncementSettingsDefaultNoticesJsonUrl)
|
||||
s.NoticesURL = NewString(AnnouncementSettingsDefaultNoticesJsonURL)
|
||||
}
|
||||
if s.NoticesSkipCache == nil {
|
||||
s.NoticesSkipCache = NewBool(false)
|
||||
@@ -2369,9 +2369,9 @@ type SamlSettings struct {
|
||||
Encrypt *bool `access:"authentication_saml"`
|
||||
SignRequest *bool `access:"authentication_saml"`
|
||||
|
||||
IdpUrl *string `access:"authentication_saml"` // telemetry: none
|
||||
IdpDescriptorUrl *string `access:"authentication_saml"` // telemetry: none
|
||||
IdpMetadataUrl *string `access:"authentication_saml"` // telemetry: none
|
||||
IdpURL *string `access:"authentication_saml"` // telemetry: none
|
||||
IdpDescriptorURL *string `access:"authentication_saml"` // telemetry: none
|
||||
IdpMetadataURL *string `access:"authentication_saml"` // telemetry: none
|
||||
ServiceProviderIdentifier *string `access:"authentication_saml"` // telemetry: none
|
||||
AssertionConsumerServiceURL *string `access:"authentication_saml"` // telemetry: none
|
||||
|
||||
@@ -2446,24 +2446,24 @@ func (s *SamlSettings) SetDefaults() {
|
||||
s.CanonicalAlgorithm = NewString(SamlSettingsDefaultCanonicalAlgorithm)
|
||||
}
|
||||
|
||||
if s.IdpUrl == nil {
|
||||
s.IdpUrl = NewString("")
|
||||
if s.IdpURL == nil {
|
||||
s.IdpURL = NewString("")
|
||||
}
|
||||
|
||||
if s.IdpDescriptorUrl == nil {
|
||||
s.IdpDescriptorUrl = NewString("")
|
||||
if s.IdpDescriptorURL == nil {
|
||||
s.IdpDescriptorURL = NewString("")
|
||||
}
|
||||
|
||||
if s.ServiceProviderIdentifier == nil {
|
||||
if s.IdpDescriptorUrl != nil {
|
||||
s.ServiceProviderIdentifier = NewString(*s.IdpDescriptorUrl)
|
||||
if s.IdpDescriptorURL != nil {
|
||||
s.ServiceProviderIdentifier = NewString(*s.IdpDescriptorURL)
|
||||
} else {
|
||||
s.ServiceProviderIdentifier = NewString("")
|
||||
}
|
||||
}
|
||||
|
||||
if s.IdpMetadataUrl == nil {
|
||||
s.IdpMetadataUrl = NewString("")
|
||||
if s.IdpMetadataURL == nil {
|
||||
s.IdpMetadataURL = NewString("")
|
||||
}
|
||||
|
||||
if s.IdpCertificateFile == nil {
|
||||
@@ -2571,7 +2571,7 @@ func (s *NativeAppSettings) SetDefaults() {
|
||||
}
|
||||
|
||||
type ElasticsearchSettings struct {
|
||||
ConnectionUrl *string `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"`
|
||||
ConnectionURL *string `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"`
|
||||
Username *string `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"`
|
||||
Password *string `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"`
|
||||
EnableIndexing *bool `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"`
|
||||
@@ -2595,8 +2595,8 @@ type ElasticsearchSettings struct {
|
||||
}
|
||||
|
||||
func (s *ElasticsearchSettings) SetDefaults() {
|
||||
if s.ConnectionUrl == nil {
|
||||
s.ConnectionUrl = NewString(ElasticsearchSettingsDefaultConnectionUrl)
|
||||
if s.ConnectionURL == nil {
|
||||
s.ConnectionURL = NewString(ElasticsearchSettingsDefaultConnectionURL)
|
||||
}
|
||||
|
||||
if s.Username == nil {
|
||||
@@ -2761,16 +2761,16 @@ func (s *JobSettings) SetDefaults() {
|
||||
}
|
||||
|
||||
type CloudSettings struct {
|
||||
CWSUrl *string `access:"write_restrictable"`
|
||||
CWSAPIUrl *string `access:"write_restrictable"`
|
||||
CWSURL *string `access:"write_restrictable"`
|
||||
CWSAPIURL *string `access:"write_restrictable"`
|
||||
}
|
||||
|
||||
func (s *CloudSettings) SetDefaults() {
|
||||
if s.CWSUrl == nil {
|
||||
s.CWSUrl = NewString(CloudSettingsDefaultCwsUrl)
|
||||
if s.CWSURL == nil {
|
||||
s.CWSURL = NewString(CloudSettingsDefaultCwsURL)
|
||||
}
|
||||
if s.CWSAPIUrl == nil {
|
||||
s.CWSAPIUrl = NewString(CloudSettingsDefaultCwsApiUrl)
|
||||
if s.CWSAPIURL == nil {
|
||||
s.CWSAPIURL = NewString(CloudSettingsDefaultCwsAPIURL)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2781,7 +2781,7 @@ type PluginState struct {
|
||||
type PluginSettings struct {
|
||||
Enable *bool `access:"plugins,write_restrictable"`
|
||||
EnableUploads *bool `access:"plugins,write_restrictable,cloud_restrictable"`
|
||||
AllowInsecureDownloadUrl *bool `access:"plugins,write_restrictable,cloud_restrictable"`
|
||||
AllowInsecureDownloadURL *bool `access:"plugins,write_restrictable,cloud_restrictable"`
|
||||
EnableHealthCheck *bool `access:"plugins,write_restrictable,cloud_restrictable"`
|
||||
Directory *string `access:"plugins,write_restrictable,cloud_restrictable"` // telemetry: none
|
||||
ClientDirectory *string `access:"plugins,write_restrictable,cloud_restrictable"` // telemetry: none
|
||||
@@ -2791,9 +2791,9 @@ type PluginSettings struct {
|
||||
EnableRemoteMarketplace *bool `access:"plugins,write_restrictable,cloud_restrictable"`
|
||||
AutomaticPrepackagedPlugins *bool `access:"plugins,write_restrictable,cloud_restrictable"`
|
||||
RequirePluginSignature *bool `access:"plugins,write_restrictable,cloud_restrictable"`
|
||||
MarketplaceUrl *string `access:"plugins,write_restrictable,cloud_restrictable"`
|
||||
MarketplaceURL *string `access:"plugins,write_restrictable,cloud_restrictable"`
|
||||
SignaturePublicKeyFiles []string `access:"plugins,write_restrictable,cloud_restrictable"`
|
||||
ChimeraOAuthProxyUrl *string `access:"plugins,write_restrictable,cloud_restrictable"`
|
||||
ChimeraOAuthProxyURL *string `access:"plugins,write_restrictable,cloud_restrictable"`
|
||||
}
|
||||
|
||||
func (s *PluginSettings) SetDefaults(ls LogSettings) {
|
||||
@@ -2805,8 +2805,8 @@ func (s *PluginSettings) SetDefaults(ls LogSettings) {
|
||||
s.EnableUploads = NewBool(false)
|
||||
}
|
||||
|
||||
if s.AllowInsecureDownloadUrl == nil {
|
||||
s.AllowInsecureDownloadUrl = NewBool(false)
|
||||
if s.AllowInsecureDownloadURL == nil {
|
||||
s.AllowInsecureDownloadURL = NewBool(false)
|
||||
}
|
||||
|
||||
if s.EnableHealthCheck == nil {
|
||||
@@ -2856,8 +2856,8 @@ func (s *PluginSettings) SetDefaults(ls LogSettings) {
|
||||
s.AutomaticPrepackagedPlugins = NewBool(true)
|
||||
}
|
||||
|
||||
if s.MarketplaceUrl == nil || *s.MarketplaceUrl == "" || *s.MarketplaceUrl == PluginSettingsOldMarketplaceUrl {
|
||||
s.MarketplaceUrl = NewString(PluginSettingsDefaultMarketplaceUrl)
|
||||
if s.MarketplaceURL == nil || *s.MarketplaceURL == "" || *s.MarketplaceURL == PluginSettingsOldMarketplaceURL {
|
||||
s.MarketplaceURL = NewString(PluginSettingsDefaultMarketplaceURL)
|
||||
}
|
||||
|
||||
if s.RequirePluginSignature == nil {
|
||||
@@ -2868,8 +2868,8 @@ func (s *PluginSettings) SetDefaults(ls LogSettings) {
|
||||
s.SignaturePublicKeyFiles = []string{}
|
||||
}
|
||||
|
||||
if s.ChimeraOAuthProxyUrl == nil {
|
||||
s.ChimeraOAuthProxyUrl = NewString("")
|
||||
if s.ChimeraOAuthProxyURL == nil {
|
||||
s.ChimeraOAuthProxyURL = NewString("")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2943,14 +2943,14 @@ func (s *MessageExportSettings) SetDefaults() {
|
||||
}
|
||||
|
||||
type DisplaySettings struct {
|
||||
CustomUrlSchemes []string `access:"site_customization"`
|
||||
CustomURLSchemes []string `access:"site_customization"`
|
||||
ExperimentalTimezone *bool `access:"experimental_features"`
|
||||
}
|
||||
|
||||
func (s *DisplaySettings) SetDefaults() {
|
||||
if s.CustomUrlSchemes == nil {
|
||||
customUrlSchemes := []string{}
|
||||
s.CustomUrlSchemes = customUrlSchemes
|
||||
if s.CustomURLSchemes == nil {
|
||||
customURLSchemes := []string{}
|
||||
s.CustomURLSchemes = customURLSchemes
|
||||
}
|
||||
|
||||
if s.ExperimentalTimezone == nil {
|
||||
@@ -3245,7 +3245,7 @@ func (o *Config) SetDefaults() {
|
||||
o.Office365Settings.setDefaults()
|
||||
o.Office365Settings.setDefaults()
|
||||
o.GitLabSettings.setDefaults("", "", "", "", "")
|
||||
o.GoogleSettings.setDefaults(GoogleSettingsDefaultScope, GoogleSettingsDefaultAuthEndpoint, GoogleSettingsDefaultTokenEndpoint, GoogleSettingsDefaultUserApiEndpoint, "")
|
||||
o.GoogleSettings.setDefaults(GoogleSettingsDefaultScope, GoogleSettingsDefaultAuthEndpoint, GoogleSettingsDefaultTokenEndpoint, GoogleSettingsDefaultUserAPIEndpoint, "")
|
||||
o.OpenIdSettings.setDefaults(OpenidSettingsDefaultScope, "", "", "", "#145DBF")
|
||||
o.ServiceSettings.SetDefaults(isUpdate)
|
||||
o.PasswordSettings.SetDefaults()
|
||||
@@ -3547,11 +3547,11 @@ func (s *LdapSettings) isValid() *AppError {
|
||||
|
||||
func (s *SamlSettings) isValid() *AppError {
|
||||
if *s.Enable {
|
||||
if *s.IdpUrl == "" || !IsValidHTTPUrl(*s.IdpUrl) {
|
||||
if *s.IdpURL == "" || !IsValidHTTPURL(*s.IdpURL) {
|
||||
return NewAppError("Config.IsValid", "model.config.is_valid.saml_idp_url.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
if *s.IdpDescriptorUrl == "" || !IsValidHTTPUrl(*s.IdpDescriptorUrl) {
|
||||
if *s.IdpDescriptorURL == "" || !IsValidHTTPURL(*s.IdpDescriptorURL) {
|
||||
return NewAppError("Config.IsValid", "model.config.is_valid.saml_idp_descriptor_url.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
@@ -3572,7 +3572,7 @@ func (s *SamlSettings) isValid() *AppError {
|
||||
}
|
||||
|
||||
if *s.Verify {
|
||||
if *s.AssertionConsumerServiceURL == "" || !IsValidHTTPUrl(*s.AssertionConsumerServiceURL) {
|
||||
if *s.AssertionConsumerServiceURL == "" || !IsValidHTTPURL(*s.AssertionConsumerServiceURL) {
|
||||
return NewAppError("Config.IsValid", "model.config.is_valid.saml_assertion_consumer_service_url.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
}
|
||||
@@ -3708,7 +3708,7 @@ func (s *ServiceSettings) isValid() *AppError {
|
||||
|
||||
func (s *ElasticsearchSettings) isValid() *AppError {
|
||||
if *s.EnableIndexing {
|
||||
if *s.ConnectionUrl == "" {
|
||||
if *s.ConnectionURL == "" {
|
||||
return NewAppError("Config.IsValid", "model.config.is_valid.elastic_search.connection_url.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
}
|
||||
@@ -3827,10 +3827,10 @@ func (s *MessageExportSettings) isValid() *AppError {
|
||||
}
|
||||
|
||||
func (s *DisplaySettings) isValid() *AppError {
|
||||
if len(s.CustomUrlSchemes) != 0 {
|
||||
if len(s.CustomURLSchemes) != 0 {
|
||||
validProtocolPattern := regexp.MustCompile(`(?i)^\s*[A-Za-z][A-Za-z0-9.+-]*\s*$`)
|
||||
|
||||
for _, scheme := range s.CustomUrlSchemes {
|
||||
for _, scheme := range s.CustomURLSchemes {
|
||||
if !validProtocolPattern.MatchString(scheme) {
|
||||
return NewAppError(
|
||||
"Config.IsValid",
|
||||
@@ -3923,8 +3923,8 @@ func (o *Config) Sanitize() {
|
||||
*o.MessageExportSettings.GlobalRelaySettings.SMTPPassword = FakeSetting
|
||||
}
|
||||
|
||||
if o.ServiceSettings.GfycatApiSecret != nil && *o.ServiceSettings.GfycatApiSecret != "" {
|
||||
*o.ServiceSettings.GfycatApiSecret = FakeSetting
|
||||
if o.ServiceSettings.GfycatAPISecret != nil && *o.ServiceSettings.GfycatAPISecret != "" {
|
||||
*o.ServiceSettings.GfycatAPISecret = FakeSetting
|
||||
}
|
||||
|
||||
*o.ServiceSettings.SplitKey = FakeSetting
|
||||
@@ -4046,7 +4046,7 @@ func isDomainName(s string) bool {
|
||||
|
||||
func isSafeLink(link *string) bool {
|
||||
if link != nil {
|
||||
if IsValidHTTPUrl(*link) {
|
||||
if IsValidHTTPURL(*link) {
|
||||
return true
|
||||
} else if strings.HasPrefix(*link, "/") {
|
||||
return true
|
||||
|
||||
Ссылка в новой задаче
Block a user