mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-09 16:14:40 +00:00
The pre-existing desktopApp:UploadOrchestratorTest started failing after the desktop image-compression feature landed: - uploadCallsClientWithCorrectParameters (2x2 PNG, no quality set) - uploadPassesAuthHeaderToClient (.txt) - uploadPassesSameFileWhenNoStripExif (.txt) - uploadComputesMetadata (.txt) The orchestrator was unconditionally calling ImageReencoder.reencode, which (a) reencoded PNGs to JPEG even when the caller did not opt into compression and (b) threw UnsupportedFormat for any file the sniffer could not classify (.txt, voice memos, video files, DM attachments — the orchestrator is the upload path for everything, not just images). Two changes restore the orchestrator's original "upload as-is" behavior for callers that have not opted into compression: 1. UploadOrchestrator.upload's quality parameter is now nullable (CompressionQuality? = null). Null means "do not reencode" — matches the orchestrator's behavior before this feature, so the Android, CLI, and any non-image upload path keeps working unchanged. The desktop compose flow continues to pass a non-null CompressionQuality so it still runs the reencoder. 2. ImageReencoder no longer throws UnsupportedFormat for ImageFormat.Unknown — it returns PassThrough(NotAnImage) instead. AVIF and HEIC still throw (those are recognized formats we explicitly refuse). The new PassReason.NotAnImage is rendered in the preview dialog as "Not an image · uploaded as-is" / "Metadata preserved (non-image — no re-encode applies)". My UploadOrchestratorTest.refusesAvifWithUnsupportedFormat is updated to pass quality = MEDIUM explicitly so it still exercises the refuse path under the new opt-in model.