fix(files): pass the SDK's AccountDownloadToken to the stream URL builder - #283
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
A minimal, correct type fix that forwards the SDK's AccountDownloadToken wrapper, consistent with existing codebase patterns and covered by existing tests.
Review effort: Balanced
Findings: None
What changed in this PR
This PR fixes a compilation failure on the main branch caused by an upstream SDK change (putio-sdk-kotlin#69) where buildOriginalStreamUrl was changed to accept an AccountDownloadToken instead of a String. Since CI builds the SDK from its main branch, FilesWatchedRepository.kt stopped compiling because it was unwrapping the token to its string .value. The fix passes the AccountDownloadToken wrapper through directly.
Changes:
- Updates the
buildOriginalStreamUrllambda signature inSdkFilesStreamUrlsto takeAccountDownloadTokenand forwards the token wrapper without unwrapping.value. - Adds the
AccountDownloadTokenimport and removes the now-stale comment about the SDK's oldaccessTokenparameter name.
| File | Description |
|---|---|
app/src/main/kotlin/io/putdotio/android/files/FilesWatchedRepository.kt |
Passes the SDK's AccountDownloadToken to the stream URL builder instead of unwrapping it to a String, restoring compilation against the new SDK signature. |
I verified the change is consistent and correct:
AccountInfo.downloadTokenis typedAccountDownloadToken?, and after the null check at line 80 the value is smart-cast to non-nullAccountDownloadToken, matching the updated lambda parameter type.- This mirrors the existing pattern in
PlaybackRepository.kt:185, which already passesAccountDownloadTokendirectly toPlaybackMediaCredential.downloadToken(...). - The internal constructor lambda is only reached through the public
SdkFilesStreamUrls(client)constructor; no other call site constructs it with the old string signature, and tests use theFilesStreamUrlsfun interface directly. - Existing coverage in
SdkFilesStreamUrlsTestexercises the real SDK path end-to-end and asserts the resulting URL carries the download token (never the access token), and theReady.toString()redaction remains intact.
No issues found.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Fixes the red main build: putio-sdk-kotlin#69 changed
buildOriginalStreamUrlto takeAccountDownloadToken, and CI builds the SDK from its main branch, soFilesWatchedRepository.kt:72stopped compiling ("actual type is 'String', but 'AccountDownloadToken' was expected").SdkFilesStreamUrlsnow passes the account'sAccountDownloadTokenthrough instead of unwrapping it to a string.accessTokenparameter name../gradlew verifypasses locally against putio-sdk-kotlin main (Temurin 21).Written by an agent (Claude Code, Opus 5.5)