Fix cache keys for Python version ranges (#937)

## Summary
- URL-encode the Python version component before adding it to the cache
key
- URL-encode the user-provided cache suffix for the same reason
- Add cache key tests for Python ranges, comma-containing suffixes, and
unchanged simple inputs

Fixes #914

Refs: pi-session 019f3164-85e7-7817-bffd-501d89b3a1fd

## Tests
- npm run all
This commit is contained in:
Kevin Stillhammer
2026-07-05 10:46:44 +02:00
committed by GitHub
parent 3cc3c11fdf
commit 17c398959b
4 changed files with 116 additions and 4 deletions

View File

@@ -94,8 +94,10 @@ async function computeKeys(
if (cacheDependencyPathHash === "-") {
cacheDependencyPathHash = "-no-dependency-glob";
}
const suffix = inputs.cacheSuffix ? `-${inputs.cacheSuffix}` : "";
const version = pythonVersion ?? "unknown";
const suffix = inputs.cacheSuffix
? `-${encodeURIComponent(inputs.cacheSuffix)}`
: "";
const version = encodeURIComponent(pythonVersion ?? "unknown");
const platform = await getPlatform();
const osNameVersion = getOSNameVersion();
const pruned = inputs.pruneCache ? "-pruned" : "";