mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-18 09:07:28 -06:00
[chore] ffmpeg webassembly fiddling (#4454)
This disables ffmpeg / ffprobe support on platforms where the wazero compiler is not available. The slowness introduced is hard to pindown for admins (and us!), so it's easier to just return an error message linking to docs on attempted media processing. It still allows the instance to run, just erroring if anything other than a jpeg is attempted to be processed. This should hopefully make it easier for users to notice these issues. Also further locks down our wazero 'allowFiles' fs and other media code to address: https://codeberg.org/superseriousbusiness/gotosocial/issues/4408 relates to: https://codeberg.org/superseriousbusiness/gotosocial/issues/4427 also relates to issues raised in #gotosocial-help on matrix closes https://codeberg.org/superseriousbusiness/gotosocial/issues/4408 Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4454 Co-authored-by: kim <grufwub@gmail.com> Co-committed-by: kim <grufwub@gmail.com>
This commit is contained in:
parent
121677754c
commit
3db2d42247
7 changed files with 111 additions and 97 deletions
|
|
@ -74,20 +74,28 @@ func clearMetadata(ctx context.Context, filepath string) error {
|
|||
|
||||
// terminateExif cleans exif data from file at input path, into file
|
||||
// at output path, using given file extension to determine cleaning type.
|
||||
func terminateExif(outpath, inpath string, ext string) error {
|
||||
func terminateExif(outpath, inpath string, ext string) (err error) {
|
||||
var inFile *os.File
|
||||
var outFile *os.File
|
||||
|
||||
// Ensure handles
|
||||
// closed on return.
|
||||
defer func() {
|
||||
outFile.Close()
|
||||
inFile.Close()
|
||||
}()
|
||||
|
||||
// Open input file at given path.
|
||||
inFile, err := os.Open(inpath)
|
||||
inFile, err = openRead(inpath)
|
||||
if err != nil {
|
||||
return gtserror.Newf("error opening input file %s: %w", inpath, err)
|
||||
}
|
||||
defer inFile.Close()
|
||||
|
||||
// Open output file at given path.
|
||||
outFile, err := os.Create(outpath)
|
||||
// Create output file at given path.
|
||||
outFile, err = openWrite(outpath)
|
||||
if err != nil {
|
||||
return gtserror.Newf("error opening output file %s: %w", outpath, err)
|
||||
}
|
||||
defer outFile.Close()
|
||||
|
||||
// Terminate EXIF data from 'inFile' -> 'outFile'.
|
||||
err = terminator.TerminateInto(outFile, inFile, ext)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue