Skip to content

fix(ios): dynamically migrate absolute file paths after app update#502

Merged
RadicalMuffinMan merged 1 commit into
Moonfin-Client:mainfrom
mattsigal:bugfix/ios-sandbox-path-migration
Jun 11, 2026
Merged

fix(ios): dynamically migrate absolute file paths after app update#502
RadicalMuffinMan merged 1 commit into
Moonfin-Client:mainfrom
mattsigal:bugfix/ios-sandbox-path-migration

Conversation

@mattsigal

Copy link
Copy Markdown
Contributor

Pull Request

Summary

Resolves an issue on iOS where downloaded offline media files and artwork images become inaccessible after the app is upgraded. Because iOS updates regenerate the application's container UUID, any stored absolute paths in the offline database referencing the old container path break.

This change introduces a startup migration routine that queries the current application documents path and automatically translates any stored absolute database paths containing a legacy UUID to the current container path, while leaving non-sandbox and other platforms' paths untouched.

Related Issues

Link related issues or tickets separated by commas.

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Performance improvement
  • UI/UX update
  • Documentation update
  • Build/CI change
  • Other (describe):

Changes Made

  1. Offline Repository: Added updateItemPaths in OfflineRepository to update path fields (localFilePath, posterPath, backdropPath, logoPath, thumbPath) of a downloaded item without modifying other columns.
  2. Startup Initialization: Added migrateIosPath helper and _migrateIosPaths routine in injection.dart to query, translate, and update all stored paths to match the current Documents directory container on iOS startup.
  3. Unit Tests: Added path_migration_test.dart to verify path translation behavior.

Platform

  • Android
  • iOS
  • macOS
  • Windows
  • Linux
  • All / Shared code

Testing

Describe how this change was tested.

  • Tested on emulator / simulator
  • Tested on physical device
  • Manual testing completed
  • Not tested (explain why): Built but have no iOS devices.

Checklist

  • Code builds successfully
  • Code follows project style and conventions
  • No unnecessary commented-out code
  • No new warnings introduced

When an iOS application is updated, the sandbox container UUID changes.
Any absolute paths stored in the offline database pointing to the app's Documents folder (such as downloaded media files and local artwork images) become invalid, causing downloaded media to appear missing.

This commit resolves the issue by:
1. Adding an `updateItemPaths` method to `OfflineRepository`.
2. Implementing a startup migration helper in `injection.dart` to automatically translate stored absolute paths containing the old UUID to the current container path.
3. Adding unit tests for the iOS path migration helper.
@RadicalMuffinMan RadicalMuffinMan merged commit 0a0371d into Moonfin-Client:main Jun 11, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Failed playing of Saved Media if Files app is locked by biometrics, after Moonfin upgrade

2 participants