mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-15 21:33:02 -06:00
Tidying and linting
This commit is contained in:
parent
e497794059
commit
1d017d0563
11 changed files with 85 additions and 92 deletions
|
|
@ -120,7 +120,7 @@ func (mh *mediaHandler) processHeaderOrAvi(imageBytes []byte, contentType string
|
|||
return nil, errors.New("header or avatar not selected")
|
||||
}
|
||||
|
||||
clean := []byte{}
|
||||
var clean []byte
|
||||
var err error
|
||||
|
||||
switch contentType {
|
||||
|
|
@ -152,7 +152,7 @@ func (mh *mediaHandler) processHeaderOrAvi(imageBytes []byte, contentType string
|
|||
extension := strings.Split(contentType, "/")[1]
|
||||
newMediaID := uuid.NewString()
|
||||
|
||||
base := fmt.Sprintf("%s://%s%s", mh.config.StorageConfig.ServeProtocol, mh.config.StorageConfig.ServeHost, mh.config.StorageConfig.ServeBasePath, )
|
||||
base := fmt.Sprintf("%s://%s%s", mh.config.StorageConfig.ServeProtocol, mh.config.StorageConfig.ServeHost, mh.config.StorageConfig.ServeBasePath)
|
||||
|
||||
// we store the original...
|
||||
originalPath := fmt.Sprintf("%s/%s/%s/original/%s.%s", base, accountID, headerOrAvi, newMediaID, extension)
|
||||
|
|
|
|||
|
|
@ -70,10 +70,10 @@ func (suite *MediaTestSuite) SetupSuite() {
|
|||
MaxImageSize: 2 << 20,
|
||||
}
|
||||
c.StorageConfig = &config.StorageConfig{
|
||||
Backend: "local",
|
||||
BasePath: "/tmp",
|
||||
Backend: "local",
|
||||
BasePath: "/tmp",
|
||||
ServeProtocol: "http",
|
||||
ServeHost: "localhost",
|
||||
ServeHost: "localhost",
|
||||
ServeBasePath: "/fileserver/media",
|
||||
}
|
||||
suite.config = c
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ func supportedImageType(mimeType string) bool {
|
|||
// purgeExif is a little wrapper for the action of removing exif data from an image.
|
||||
// Only pass pngs or jpegs to this function.
|
||||
func purgeExif(b []byte) ([]byte, error) {
|
||||
if b == nil || len(b) == 0 {
|
||||
if len(b) == 0 {
|
||||
return nil, errors.New("passed image was not valid")
|
||||
}
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ func purgeExif(b []byte) ([]byte, error) {
|
|||
if err != nil {
|
||||
return nil, fmt.Errorf("could not purge exif from image: %s", err)
|
||||
}
|
||||
if clean == nil || len(clean) == 0 {
|
||||
if len(clean) == 0 {
|
||||
return nil, errors.New("purged image was not valid")
|
||||
}
|
||||
return clean, nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue