summaryrefslogtreecommitdiff
path: root/internal/media/probe.go
diff options
context:
space:
mode:
authorLibravatar kim <grufwub@gmail.com>2025-09-24 15:12:25 +0200
committerLibravatar kim <gruf@noreply.codeberg.org>2025-09-24 15:12:25 +0200
commit3db2d42247c5f88196ae7fb68b6bbec603bb7f26 (patch)
tree4fa7e793b230757219941f5b5a936a79b77eb000 /internal/media/probe.go
parent[docs] Update tracing.md with up-to-date way of doing things (#4452) (diff)
downloadgotosocial-3db2d42247c5f88196ae7fb68b6bbec603bb7f26.tar.xz
[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>
Diffstat (limited to 'internal/media/probe.go')
-rw-r--r--internal/media/probe.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/internal/media/probe.go b/internal/media/probe.go
index 791b6a8c2..c66254b90 100644
--- a/internal/media/probe.go
+++ b/internal/media/probe.go
@@ -38,8 +38,9 @@ const (
// probe will first attempt to probe the file at path using native Go code
// (for performance), but falls back to using ffprobe to retrieve media details.
func probe(ctx context.Context, filepath string) (*result, error) {
+
// Open input file at given path.
- file, err := os.Open(filepath)
+ file, err := openRead(filepath)
if err != nil {
return nil, gtserror.Newf("error opening file %s: %w", filepath, err)
}
@@ -80,6 +81,7 @@ func probe(ctx context.Context, filepath string) (*result, error) {
// probeJPEG decodes the given file as JPEG and determines
// image details from the decoded JPEG using native Go code.
func probeJPEG(file *os.File) (*result, error) {
+
// Attempt to decode JPEG, adding back hdr magic.
cfg, err := jpeg.DecodeConfig(io.MultiReader(
strings.NewReader(magicJPEG),