Modern Apps git

← Modern-Apps.git

cast: decode both hex digits of a percent escape in MediaProxy paths

Commit
24ef31a0062563901ad2d95698075ada03e93e41
Author
Vayun Mathur <[email protected]>
When
2026-11-06 05:27 UTC (1 month ago)
Parents
dc70433
827ba5556 replaced substring(i + 1, i + 3) with i + PERCENT_HEX_DIGITS - 1, so only one
hex digit was parsed (%20 became 0x02). Caught by MediaProxyTest.

Diff

cast/protocol/src/main/java/com/vayunmathur/cast/protocol/MediaProxy.kt
diff --git a/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/MediaProxy.kt b/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/MediaProxy.ktindex e3662eaab4..11f14119a6 100644--- a/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/MediaProxy.kt+++ b/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/MediaProxy.kt@@ -553,7 +553,7 @@ class MediaProxyExchange(             while (i < text.length) {                 val c = text[i]                 if (c == '%' && i + 2 < text.length) {-                    val hex = text.substring(i + 1, i + PERCENT_HEX_DIGITS - 1).toIntOrNull(HEX_RADIX)+                    val hex = text.substring(i + 1, i + PERCENT_HEX_DIGITS).toIntOrNull(HEX_RADIX)                     if (hex != null) {                         out.write(hex)                         i += PERCENT_HEX_DIGITS