Bugfix/storacha upload failure fix#757
Merged
prathieshna merged 4 commits intofeature/storachafrom Feb 24, 2026
Merged
Conversation
added 3 commits
February 10, 2026 18:23
… Storacha uploads
Updated the Storacha upload and metadata fetching logic to better handle direct file access and preserve original filenames via UnixFS directory wrapping.
- **Enhanced Metadata Fetching:**
- Implemented a `HEAD` request check in `FileMetadataFetcher` to handle direct file URLs (non-HTML directory listings).
- Added logic to extract filenames from `Content-Disposition` headers and fallback to truncated CIDs.
- Added MIME type detection and human-readable file size formatting.
- **Upload Improvements:**
- Updated `StorachaApiService` and `BridgeUploader` to accept and send the original `fileName` to the backend.
- Modified `StorachaMediaViewModel` and `StorachaMediaFragment` to capture and pass the original filename during the upload process.
- The backend now uses the provided filename to wrap uploads in a UnixFS directory structure, improving file identification on IPFS gateways.
- **Robustness:**
- Improved CID extraction from various gateway URL formats (path-based and subdomain-based).
- Updated retry logic to persist original filenames for failed uploads.
This commit introduces significant improvements to the file upload process for better performance and user experience. It implements optimistic updates, robust retry logic, and prevents memory issues with large files.
- **Optimistic UI for Uploads:**
- New uploads now appear in the media list immediately, providing instant user feedback without waiting for server confirmation.
- A silent background sync follows to ensure data consistency without blocking the UI.
- **Robust Uploads with Retries:**
- Implemented a retry mechanism for file uploads (`uploadWithRetry`).
- The system now automatically retries uploads up to 3 times on transient network errors (`IOException`) or 5xx server errors, with exponential backoff.
- **Memory Optimization:**
- Created a dedicated `OkHttpClient` (`uploadClient`) for file transfers that omits the logging interceptor, preventing `OutOfMemoryError` when uploading large files.
- The default API client's logging level was changed from `BODY` to `HEADERS` to avoid logging large request/response bodies.
- **UI State Handling:**
- Improved loading and error state management to prevent showing an "empty" screen if a background refresh fails while cached media is available.
There was a problem hiding this comment.
detekt found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
…r to handle a single capture
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restricted file selection to a single file and updated camera launcher to handle a single capture so that any issues stemming from multiple file upload in Storacha which is not fully completed will not be executed.
Also this is using the work around to upload files instead of using the bridge.