fix: Add validation for corrupted database cache and downloads#114
Draft
ConsciousEnergy wants to merge 1 commit intoEpisk-pos:mainfrom
Draft
fix: Add validation for corrupted database cache and downloads#114ConsciousEnergy wants to merge 1 commit intoEpisk-pos:mainfrom
ConsciousEnergy wants to merge 1 commit intoEpisk-pos:mainfrom
Conversation
- Add cache validation (size >100MB + SQLite magic bytes check) - Add download validation before caching - Add content-type checking to detect HTML error pages early - Auto-recovery: clear corrupted cache and trigger fresh download - Better error messages with download instructions Fixes Episk-pos#53 (partial - addresses root cause of corrupted cache) Files: - src/services/database.ts - src/services/dbCache.ts
Contributor
|
Thanks again @ConsciousEnergy for stepping up! ❤️🔥 As I was reviewing #53, I realized that I did make some changes in this direction already, but after discussing it with Claude, it seems like left some room for improvement, and the changes you propose include some additional improvements still. |
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.

This PR adds robust validation to prevent and recover from corrupted database cache scenarios.
Problem:
When the database file is missing or corrupted, the app would cache HTML error pages (404 responses)
in IndexedDB, leading to "file is not a database" errors on subsequent loads.
Solution:
Related Issues:
Testing:
Files Changed:
src/services/database.ts- Added validation logicsrc/services/dbCache.ts- Cleaned up debug logssrc/services/queryService.ts- Minor cleanup