[MM-51487] allow uppercase team/channel names for import (#28906)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
98d341fbae
Коммит
64b30abbce
@@ -122,7 +122,7 @@ func ValidateTeamImportData(data *TeamImportData) *model.AppError {
|
||||
return model.NewAppError("BulkImport", "app.import.validate_team_import_data.name_length.error", nil, "", http.StatusBadRequest)
|
||||
} else if model.IsReservedTeamName(*data.Name) {
|
||||
return model.NewAppError("BulkImport", "app.import.validate_team_import_data.name_reserved.error", nil, "", http.StatusBadRequest)
|
||||
} else if !model.IsValidTeamName(*data.Name) {
|
||||
} else if !model.IsValidTeamName(strings.ToLower(*data.Name)) { // uppercase letters are not allowed in team names, but for import path we are more forgiving
|
||||
return model.NewAppError("BulkImport", "app.import.validate_team_import_data.name_characters.error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ func ValidateChannelImportData(data *ChannelImportData) *model.AppError {
|
||||
return model.NewAppError("BulkImport", "app.import.validate_channel_import_data.name_missing.error", nil, "", http.StatusBadRequest)
|
||||
} else if len(*data.Name) > model.ChannelNameMaxLength {
|
||||
return model.NewAppError("BulkImport", "app.import.validate_channel_import_data.name_length.error", nil, "", http.StatusBadRequest)
|
||||
} else if !model.IsValidChannelIdentifier(*data.Name) {
|
||||
} else if !model.IsValidChannelIdentifier(strings.ToLower(*data.Name)) { // uppercase letters are not allowed in channel names, but for import path we are more forgiving
|
||||
return model.NewAppError("BulkImport", "app.import.validate_channel_import_data.name_characters.error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
|
||||
@@ -393,7 +393,7 @@ func TestImportValidateChannelImportData(t *testing.T) {
|
||||
|
||||
data.Name = model.NewPointer("A")
|
||||
err = ValidateChannelImportData(&data)
|
||||
require.NotNil(t, err, "Should have failed due to short name.")
|
||||
require.Nil(t, err, "Should not have failed due to uppercased name.")
|
||||
|
||||
// Test team various invalid display names.
|
||||
data = ChannelImportData{
|
||||
|
||||
Ссылка в новой задаче
Block a user