CLAUDE.md's Common Pitfalls section says:
currentFilename may be percent-encoded — always decodeURIComponent(currentFilename) before building URLs in pane plugins.
"May be" + "always decode" is a lossy pair. If currentFilename is sometimes not encoded, and a real filename legitimately contains a % (e.g. 100% Live.sloppak), an unconditional decodeURIComponent call either throws a URIError (malformed sequence) or silently corrupts the name (a %XX that happens to look like valid encoding). The doc doesn't establish the invariant it's assuming ("currentFilename is always exactly-once encoded when this rule applies").
Suggest one of:
- Establish and document the actual invariant at the source (
playSong always receives an encoded name / always receives raw — pick one and enforce it), or
- Decode defensively:
try { decodeURIComponent(x) } catch { x }, or detect whether the string is already encoded before decoding.
CLAUDE.md's Common Pitfalls section says:
"May be" + "always decode" is a lossy pair. If
currentFilenameis sometimes not encoded, and a real filename legitimately contains a%(e.g.100% Live.sloppak), an unconditionaldecodeURIComponentcall either throws aURIError(malformed sequence) or silently corrupts the name (a%XXthat happens to look like valid encoding). The doc doesn't establish the invariant it's assuming ("currentFilename is always exactly-once encoded when this rule applies").Suggest one of:
playSongalways receives an encoded name / always receives raw — pick one and enforce it), ortry { decodeURIComponent(x) } catch { x }, or detect whether the string is already encoded before decoding.