[bugfix] moves file rename to earlier in media pipeline so ffmpeg calls ALWAYS have extension (#3146)

This commit is contained in:
kim 2024-07-28 08:31:49 +00:00 committed by GitHub
commit 58f8082795
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 55 additions and 23 deletions

View file

@ -19,6 +19,7 @@ package media
import (
"context"
"os"
errorsv2 "codeberg.org/gruf/go-errors/v2"
"codeberg.org/gruf/go-runners"
@ -169,6 +170,18 @@ func (p *ProcessingEmoji) store(ctx context.Context) error {
return gtserror.Newf("unsupported emoji filetype: %s (%s)", fileType, ext)
}
// Add file extension to path.
newpath := temppath + "." + ext
// Before ffmpeg processing, rename to set file ext.
if err := os.Rename(temppath, newpath); err != nil {
return gtserror.Newf("error renaming to %s - >%s: %w", temppath, newpath, err)
}
// Update path var
// AFTER successful.
temppath = newpath
// Generate a static image from input emoji path.
staticpath, err = ffmpegGenerateStatic(ctx, temppath)
if err != nil {