diff options
| author | 2021-12-20 15:19:53 +0100 | |
|---|---|---|
| committer | 2021-12-20 15:19:53 +0100 | |
| commit | cb8688f4298a1a3ed5e28565004588be3c071df0 (patch) | |
| tree | 038b196e914b949857bf8b7c00f22374408bc1ca /internal/processing/media | |
| parent | return first offer when no accept header set (#351) (diff) | |
| download | gotosocial-cb8688f4298a1a3ed5e28565004588be3c071df0.tar.xz | |
Remove unnecessary storage config variables (#344)
* rewire config to not use extraneous serve vars
* rename 'file' to 'local' for consistency
* use Type and Size again
Diffstat (limited to 'internal/processing/media')
| -rw-r--r-- | internal/processing/media/getfile.go | 12 | 
1 files changed, 6 insertions, 6 deletions
diff --git a/internal/processing/media/getfile.go b/internal/processing/media/getfile.go index 3cfdbe56b..52ea04484 100644 --- a/internal/processing/media/getfile.go +++ b/internal/processing/media/getfile.go @@ -72,7 +72,7 @@ func (p *processor) GetFile(ctx context.Context, account *gtsmodel.Account, form  	content := &apimodel.Content{}  	var storagePath string  	switch mediaType { -	case media.Emoji: +	case media.TypeEmoji:  		e := >smodel.Emoji{}  		if err := p.db.GetByID(ctx, wantedMediaID, e); err != nil {  			return nil, gtserror.NewErrorNotFound(fmt.Errorf("emoji %s could not be taken from the db: %s", wantedMediaID, err)) @@ -81,16 +81,16 @@ func (p *processor) GetFile(ctx context.Context, account *gtsmodel.Account, form  			return nil, gtserror.NewErrorNotFound(fmt.Errorf("emoji %s has been disabled", wantedMediaID))  		}  		switch mediaSize { -		case media.Original: +		case media.SizeOriginal:  			content.ContentType = e.ImageContentType  			storagePath = e.ImagePath -		case media.Static: +		case media.SizeStatic:  			content.ContentType = e.ImageStaticContentType  			storagePath = e.ImageStaticPath  		default:  			return nil, gtserror.NewErrorNotFound(fmt.Errorf("media size %s not recognized for emoji", mediaSize))  		} -	case media.Attachment, media.Header, media.Avatar: +	case media.TypeAttachment, media.TypeHeader, media.TypeAvatar:  		a, err := p.db.GetAttachmentByID(ctx, wantedMediaID)  		if err != nil {  			return nil, gtserror.NewErrorNotFound(fmt.Errorf("attachment %s could not be taken from the db: %s", wantedMediaID, err)) @@ -99,10 +99,10 @@ func (p *processor) GetFile(ctx context.Context, account *gtsmodel.Account, form  			return nil, gtserror.NewErrorNotFound(fmt.Errorf("attachment %s is not owned by %s", wantedMediaID, form.AccountID))  		}  		switch mediaSize { -		case media.Original: +		case media.SizeOriginal:  			content.ContentType = a.File.ContentType  			storagePath = a.File.Path -		case media.Small: +		case media.SizeSmall:  			content.ContentType = a.Thumbnail.ContentType  			storagePath = a.Thumbnail.Path  		default:  | 
