fix(navidrome): preserve case-sensitivity of coverArtId and prioritize local disk cache - #113
fix(navidrome): preserve case-sensitivity of coverArtId and prioritize local disk cache#113omixin wants to merge 1 commit into
Conversation
…e local disk cache
|
| Filename | Overview |
|---|---|
| app/src/main/java/com/lostf1sh/pixelplayeross/data/image/NavidromeCoilFetcher.kt | Corrects case-sensitive ID parsing and enables persistent offline caching, but cache hits bypass logout state and the new persistent files have no eviction lifecycle. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
Request[Navidrome cover request] --> Key[Build account-agnostic cache key]
Key --> Exists{Persistent file exists?}
Exists -->|Yes| Return[Return cached artwork]
Exists -->|No| Login{Logged in?}
Login -->|No| Stop[Return null]
Login -->|Yes| Download[Download and persist artwork]
Prompt To Fix All With AI
### Issue 1
app/src/main/java/com/lostf1sh/pixelplayeross/data/image/NavidromeCoilFetcher.kt:71-81
**Cache bypasses the login boundary**
When a cover remains cached after Navidrome logout, `fetch()` returns the persistent, account-agnostic file before checking `repository.isLoggedIn`, causing artwork from the previous authenticated session to remain visible and allowing an account with the same cover identifier to receive stale artwork. **How this was verified:** The cache-return branch precedes the login check, while logout does not clear this directory and the cache key contains no account or server identity.
### Issue 2
app/src/main/java/com/lostf1sh/pixelplayeross/data/image/NavidromeCoilFetcher.kt:161-164
**Persistent covers lack eviction**
Each distinct Navidrome cover now creates a `navidrome_cover_*` file under persistent `filesDir/album_art`, but existing cache maintenance only processes `song_art_*` files, so artwork storage grows with the browsed library and is not reclaimed by the application's cache cleanup.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "fix(navidrome): preserve case-sensitivit..." | Re-trigger Greptile
| @@ -80,6 +80,12 @@ class NavidromeCoilFetcher( | |||
| ) | |||
| } | |||
There was a problem hiding this comment.
Cache bypasses the login boundary
When a cover remains cached after Navidrome logout, fetch() returns the persistent, account-agnostic file before checking repository.isLoggedIn, causing artwork from the previous authenticated session to remain visible and allowing an account with the same cover identifier to receive stale artwork. How this was verified: The cache-return branch precedes the login check, while logout does not clear this directory and the cache key contains no account or server identity.
Prompt To Fix With AI
This is a comment left during a code review.
Path: app/src/main/java/com/lostf1sh/pixelplayeross/data/image/NavidromeCoilFetcher.kt
Line: 71-81
Comment:
**Cache bypasses the login boundary**
When a cover remains cached after Navidrome logout, `fetch()` returns the persistent, account-agnostic file before checking `repository.isLoggedIn`, causing artwork from the previous authenticated session to remain visible and allowing an account with the same cover identifier to receive stale artwork. **How this was verified:** The cache-return branch precedes the login check, while logout does not clear this directory and the cache key contains no account or server identity.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| val cache = cacheDir ?: File(options.context.filesDir, "album_art").also { | ||
| if (!it.exists()) it.mkdirs() | ||
| cacheDir = it | ||
| } |
There was a problem hiding this comment.
Persistent covers lack eviction
Each distinct Navidrome cover now creates a navidrome_cover_* file under persistent filesDir/album_art, but existing cache maintenance only processes song_art_* files, so artwork storage grows with the browsed library and is not reclaimed by the application's cache cleanup.
Prompt To Fix With AI
This is a comment left during a code review.
Path: app/src/main/java/com/lostf1sh/pixelplayeross/data/image/NavidromeCoilFetcher.kt
Line: 161-164
Comment:
**Persistent covers lack eviction**
Each distinct Navidrome cover now creates a `navidrome_cover_*` file under persistent `filesDir/album_art`, but existing cache maintenance only processes `song_art_*` files, so artwork storage grows with the browsed library and is not reclaimed by the application's cache cleanup.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Preserve Case-Sensitivity: Extracted
coverArtIdusinguri.schemeSpecificPartrather thanuri.host, preventing Android framework'sUri.getHost()from forcefully lowercasing case-sensitive Base64 IDs (which caused HTTP 404 / empty responses from Navidrome).Cold Start Cache Priority: Checked local disk cache (
cachedFile.exists()) before verifying online login status so cached album art loads instantly on cold app startup and offline.Persistent Storage: Saved cached artwork in persistent
filesDir/album_art/rather than volatilecacheDir.Tested and verified working on Android with Navidrome server integration.