fixed initialism errors in accordance with golang conventions in 7 files. (#24287)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
4ed3dc81bc
Коммит
2e449413e8
@@ -89,7 +89,7 @@ func init() {
|
||||
|
||||
type DialContextFunction func(ctx context.Context, network, addr string) (net.Conn, error)
|
||||
|
||||
var AddressForbidden = errors.New("address forbidden, you may need to set AllowedUntrustedInternalConnections to allow an integration access to your internal network")
|
||||
var ErrAddressForbidden = errors.New("address forbidden, you may need to set AllowedUntrustedInternalConnections to allow an integration access to your internal network")
|
||||
|
||||
func dialContextFilter(dial DialContextFunction, allowHost func(host string) bool, allowIP func(ip net.IP) bool) DialContextFunction {
|
||||
return func(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||
@@ -128,7 +128,7 @@ func dialContextFilter(dial DialContextFunction, allowHost func(host string) boo
|
||||
}
|
||||
}
|
||||
if firstErr == nil {
|
||||
return nil, AddressForbidden
|
||||
return nil, ErrAddressForbidden
|
||||
}
|
||||
return nil, firstErr
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ func TestHTTPClient(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
} else {
|
||||
require.IsType(t, &url.Error{}, err)
|
||||
require.Equal(t, AddressForbidden, err.(*url.Error).Err)
|
||||
require.Equal(t, ErrAddressForbidden, err.(*url.Error).Err)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -154,7 +154,7 @@ func TestDialContextFilter(t *testing.T) {
|
||||
require.True(t, didDial)
|
||||
} else {
|
||||
require.Error(t, err)
|
||||
require.Equal(t, err, AddressForbidden)
|
||||
require.Equal(t, err, ErrAddressForbidden)
|
||||
require.False(t, didDial)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,35 +143,35 @@ func (si *SlackImporter) SlackImport(c request.CTX, fileData multipart.File, fil
|
||||
reader := utils.NewLimitedReaderWithError(fileReader, slackImportMaxFileSize)
|
||||
if file.Name == "channels.json" {
|
||||
publicChannels, err = slackParseChannels(reader, model.ChannelTypeOpen)
|
||||
if errors.Is(err, utils.SizeLimitExceeded) {
|
||||
if errors.Is(err, utils.ErrSizeLimitExceeded) {
|
||||
log.WriteString(i18n.T("api.slackimport.slack_import.zip.file_too_large", map[string]any{"Filename": file.Name}))
|
||||
continue
|
||||
}
|
||||
channels = append(channels, publicChannels...)
|
||||
} else if file.Name == "dms.json" {
|
||||
directChannels, err = slackParseChannels(reader, model.ChannelTypeDirect)
|
||||
if errors.Is(err, utils.SizeLimitExceeded) {
|
||||
if errors.Is(err, utils.ErrSizeLimitExceeded) {
|
||||
log.WriteString(i18n.T("api.slackimport.slack_import.zip.file_too_large", map[string]any{"Filename": file.Name}))
|
||||
continue
|
||||
}
|
||||
channels = append(channels, directChannels...)
|
||||
} else if file.Name == "groups.json" {
|
||||
privateChannels, err = slackParseChannels(reader, model.ChannelTypePrivate)
|
||||
if errors.Is(err, utils.SizeLimitExceeded) {
|
||||
if errors.Is(err, utils.ErrSizeLimitExceeded) {
|
||||
log.WriteString(i18n.T("api.slackimport.slack_import.zip.file_too_large", map[string]any{"Filename": file.Name}))
|
||||
continue
|
||||
}
|
||||
channels = append(channels, privateChannels...)
|
||||
} else if file.Name == "mpims.json" {
|
||||
groupChannels, err = slackParseChannels(reader, model.ChannelTypeGroup)
|
||||
if errors.Is(err, utils.SizeLimitExceeded) {
|
||||
if errors.Is(err, utils.ErrSizeLimitExceeded) {
|
||||
log.WriteString(i18n.T("api.slackimport.slack_import.zip.file_too_large", map[string]any{"Filename": file.Name}))
|
||||
continue
|
||||
}
|
||||
channels = append(channels, groupChannels...)
|
||||
} else if file.Name == "users.json" {
|
||||
users, err = slackParseUsers(reader)
|
||||
if errors.Is(err, utils.SizeLimitExceeded) {
|
||||
if errors.Is(err, utils.ErrSizeLimitExceeded) {
|
||||
log.WriteString(i18n.T("api.slackimport.slack_import.zip.file_too_large", map[string]any{"Filename": file.Name}))
|
||||
continue
|
||||
}
|
||||
@@ -179,7 +179,7 @@ func (si *SlackImporter) SlackImport(c request.CTX, fileData multipart.File, fil
|
||||
spl := strings.Split(file.Name, "/")
|
||||
if len(spl) == 2 && strings.HasSuffix(spl[1], ".json") {
|
||||
newposts, err := slackParsePosts(reader)
|
||||
if errors.Is(err, utils.SizeLimitExceeded) {
|
||||
if errors.Is(err, utils.ErrSizeLimitExceeded) {
|
||||
log.WriteString(i18n.T("api.slackimport.slack_import.zip.file_too_large", map[string]any{"Filename": file.Name}))
|
||||
continue
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user