Skip to content

Conversation

@manton
Copy link
Contributor

@manton manton commented Jan 8, 2026

Motivation

  • Video uploads were inconsistently named (e.g. video.mov vs original filenames), causing mismatches when uploading and later referencing uploaded media.
  • Filenames coming from iOS/Android can contain spaces or unsafe characters that may break upload endpoints or local caching.
  • Large/chunked upload flow and single-file upload flow used different filename logic, leading to inconsistencies across the code paths.
  • Provide a single, predictable filename strategy to avoid upload/lookup errors and to make cached files safe.

Description

  • Added src/utils/file_names.js with inferExtensionFromType, sanitizeFileName, and buildUploadFileName helpers to infer extensions and clean filenames.
  • Updated large upload flow to use buildUploadFileName and to use sanitized target names in ensure_local_uri_for_upload so cached copies use safe filenames.
  • Updated MicroPubApi.upload_media to use buildUploadFileName when appending the file to FormData so single-file uploads use the same cleaned filename.
  • Removed an unused Platform import from MicroPubApi.js as part of the change.

Testing

  • No automated tests were run against these changes.
  • (No unit or integration tests were executed as part of this PR.)
  • Manual verification is recommended for both single-file uploads and large/chunked uploads across iOS and Android to confirm filename behavior.
  • Linting/build were not executed here.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants