Skip to content

fix(android): treat cancelled exports as terminal; honor server output filename - #620

Open
badbread wants to merge 1 commit into
mainfrom
fix/android-export-cancel-filename
Open

fix(android): treat cancelled exports as terminal; honor server output filename#620
badbread wants to merge 1 commit into
mainfrom
fix/android-export-cancel-filename

Conversation

@badbread

@badbread badbread commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Summary

Two small, verified bugs in the Android export flow (#619).

1. A cancelled export job polls forever. The server's DELETE /export/{job_id} sets status = "cancelled" and the poller is documented to stop on that one terminal state. ExportJob.isTerminal in data/Models.kt only checked isDone || isFailed, so ExportViewModel.startPolling never noticed a cancelled job and kept polling indefinitely, with the UI stuck showing a spinner. Fix: add ExportJob.isCancelled and fold it into isTerminal; the poller now stops without an error toast (cancellation is user-initiated, not a failure), and ExportScreen's status label shows "Cancelled".

2. Exported files are saved with the wrong extension. ExportOutputFile.filename on the server carries the real on-disk basename (.mkv for a no-transcode passthrough, or a whole-job .zip), but the Android model never decoded that field, and the save/share code hardcoded a crumb-export-<id>....mp4 name plus a video/mp4 MIME type regardless of the actual container. An .mkv or .zip export was saved/shared as .mp4, producing an unplayable/corrupt-looking file. Fix: decode filename, derive the extension (and matching MIME type for MediaStore / the share intent) from it at both save sites (Downloads save, and cache-then-share), falling back to mp4 only when the server didn't report a filename.

Files changed

  • apps/android/app/src/main/java/video/crumb/app/data/Models.kt: ExportOutputFile.filename, ExportJob.isCancelled/isTerminal.
  • apps/android/app/src/main/java/video/crumb/app/feature/export/ExportViewModel.kt: terminal-but-not-failed handling for cancelled jobs.
  • apps/android/app/src/main/java/video/crumb/app/feature/export/ExportScreen.kt: "Cancelled" status label, exportFileExtension/exportMimeType helpers used by saveExportToDownloads, downloadExportFileToCache, and shareLocalFile.

Test plan

  • Verified: ./gradlew :app:compileDebugKotlin testDebugUnitTest green on dev2 (BUILD SUCCESSFUL, exit 0).
  • Manual on-device check: cancel an in-progress export and confirm polling stops with a "Cancelled" status; download an .mkv-source export and confirm the saved file keeps the .mkv extension.

Fixes #619

…t filename

A cancelled export job (server status "cancelled") was never recognized as
terminal by ExportJob.isTerminal, so ExportViewModel.startPolling kept
polling it forever and the status UI showed a spinner instead of a
"Cancelled" state. Add ExportJob.isCancelled and fold it into isTerminal;
the poller now stops quietly (no error toast) and the status label shows
"Cancelled".

ExportOutputFile.filename (the server's real on-disk basename, e.g. .mkv or
a whole-job .zip) was never decoded on Android, so saved/shared exports
were always named "...mp4" with a hardcoded video/mp4 MIME type regardless
of the actual container. Decode filename and derive the extension/MIME
type from it at both save sites (Downloads save + cache-then-share),
falling back to mp4 only when the server didn't report a filename.

Fixes #619

Signed-off-by: badbread <badbread@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android export: cancelled jobs poll forever; downloads use wrong file extension

1 participant