Skip to content

Bugfix/storacha upload failure fix#757

Merged
prathieshna merged 4 commits intofeature/storachafrom
bugfix/storacha-upload-failure-fix
Feb 24, 2026
Merged

Bugfix/storacha upload failure fix#757
prathieshna merged 4 commits intofeature/storachafrom
bugfix/storacha-upload-failure-fix

Conversation

@prathieshna
Copy link

@prathieshna prathieshna commented Feb 23, 2026

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.

Prathieshna Vekneswaran 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.
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

detekt found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@prathieshna prathieshna merged commit b43839d into feature/storacha Feb 24, 2026
2 checks passed
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.

1 participant