Fixed errcheck issues in server/channels/app/imaging/decode.go (#28937)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
118d0346ee
Коммит
ead2a7c018
@@ -96,7 +96,6 @@ issues:
|
||||
channels/app/file_info.go|\
|
||||
channels/app/file_test.go|\
|
||||
channels/app/helper_test.go|\
|
||||
channels/app/imaging/decode.go|\
|
||||
channels/app/import_functions.go|\
|
||||
channels/app/import_functions_test.go|\
|
||||
channels/app/imports/import_validators.go|\
|
||||
|
||||
@@ -112,12 +112,16 @@ func (d *Decoder) DecodeConfig(rd io.Reader) (image.Config, string, error) {
|
||||
}
|
||||
|
||||
// GetDimensions returns the dimensions for the given encoded image data.
|
||||
func GetDimensions(imageData io.Reader) (int, int, error) {
|
||||
func GetDimensions(imageData io.Reader) (width int, height int, err error) {
|
||||
cfg, _, err := image.DecodeConfig(imageData)
|
||||
width, height = cfg.Width, cfg.Height
|
||||
if seeker, ok := imageData.(io.Seeker); ok {
|
||||
defer seeker.Seek(0, 0)
|
||||
_, err2 := seeker.Seek(0, 0)
|
||||
if err == nil && err2 != nil {
|
||||
err = fmt.Errorf("failed to seek back to the beginning of the image data: %w", err2)
|
||||
}
|
||||
}
|
||||
return cfg.Width, cfg.Height, err
|
||||
return
|
||||
}
|
||||
|
||||
// This is only needed to try and simplify GC work.
|
||||
|
||||
Ссылка в новой задаче
Block a user