From ba9d6b467a1f03447789844048d913738c843569 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Fri, 10 Nov 2023 19:29:26 +0100 Subject: [feature] Media attachment placeholders (#2331) * [feature] Use placeholders for unknown media types * fix read of underreported small files * switch to reduce nesting * simplify cleanup --- internal/typeutils/util.go | 84 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) (limited to 'internal/typeutils/util.go') diff --git a/internal/typeutils/util.go b/internal/typeutils/util.go index a99d9e7ae..a19588221 100644 --- a/internal/typeutils/util.go +++ b/internal/typeutils/util.go @@ -22,10 +22,17 @@ import ( "errors" "fmt" "net/url" + "path" + "slices" + "strconv" + "strings" "github.com/superseriousbusiness/gotosocial/internal/ap" + apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model" + "github.com/superseriousbusiness/gotosocial/internal/config" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/regexes" + "github.com/superseriousbusiness/gotosocial/internal/text" ) type statusInteractions struct { @@ -100,3 +107,80 @@ func getURI(withID ap.WithJSONLDId) (*url.URL, string, error) { id := idProp.Get() return id, id.String(), nil } + +// placeholdUnknownAttachments separates any attachments with type `unknown` +// out of the given slice, and returns an `