Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.
PHP ai-agentsblueskyfacebookinstagramlaravellinkedinmastodonmcpmcp-serveropen-sourcerest-apiself-hostedsocial-mediasocial-media-managementsocial-media-schedulerthreadstiktokvuejsxyoutube
refactor: use mime_content_type to reliably detect MIME from file contents instead of relying on unreliable Content-Type headers
Paulo Castellano9cf16ca0c43e
diff --git a/app/Services/Post/MediaAttacher.php b/app/Services/Post/MediaAttacher.phpindex 4698961e9..6398a3cac 100644--- a/app/Services/Post/MediaAttacher.php+++ b/app/Services/Post/MediaAttacher.php@@ -82,8 +82,9 @@ class MediaAttacher/*** Stream the URL to a temp file, aborting once we exceed the largest- * configured per-type cap (video). The actual per-type limit is- * enforced by the caller after we know the MIME.+ * configured per-type cap (video). MIME is sniffed from the file's+ * magic bytes — far more reliable than trusting the upstream+ * `Content-Type` header (CDNs misconfigure, attackers spoof).** @return array{path: string, mime: ?string, bytes: int}|null*/@@ -118,11 +119,9 @@ class MediaAttacherreturn null;}- $mime = trim(explode(';', (string) $response->header('Content-Type'))[0]);-return ['path' => $temp,- 'mime' => $mime !== '' ? $mime : null,+ 'mime' => mime_content_type($temp) ?: null,'bytes' => $bytes,];}