Plug-in Library: the catalog validator refuses dot and empty folder segments in repo

`scripts/validate.sh` now reads a `repo` folder URL
(`https://github.com/<owner>/<repo>/tree/<ref>/<path>`) as EffectCraft
does: an empty, `.` or `..` segment (also percent-encoded), or a `?`, `#`
or `\`, makes the `repo` unreadable, and every release of the package is
reported. A `.` or `..` owner or name is refused too. The check now
matches the app when the schema step is skipped.
This commit is contained in:
dotCooCoo committed 2026-11-05 23:59:53 -08:00
1 parent 5dfcadd09b
commit 400187f9d9
1 file changed
+6 -2
+6 -2
View File
@@ -46,11 +46,15 @@ echo "== 3. release URLs"
# When a package has a `repo`, every release must be an asset of that repository, as Install and
# Preview require (the loader step installs from file:// copies, which skip this check).
bad=$(jq -r '
# A path segment EffectCraft refuses: empty, `.` or `..` (also percent-encoded).
def bad_segment: . == "" or (ascii_downcase | gsub("%2e"; ".") | . == "." or . == "..");
# Only the scheme, host, owner and name compare without case; the `.git` suffix is lower case.
def repo_of:
(capture("^(?<h>[^/]+//[^/]+)/(?<o>[A-Za-z0-9._-]+)/(?<n>[A-Za-z0-9._-]+?)(\\.git)?/?$")
// capture("^(?<h>[^/]+//[^/]+)/(?<o>[A-Za-z0-9._-]+)/(?<n>[A-Za-z0-9._-]+)/tree/[^?#]+$")
| select(.h | ascii_downcase == "https://github.com") | "\(.o)/\(.n)" | ascii_downcase) // "?";
// (capture("^(?<h>[^/]+//[^/]+)/(?<o>[A-Za-z0-9._-]+)/(?<n>[A-Za-z0-9._-]+)/tree/(?<f>[^?#\\\\]+?)/?$")
| select(.f | split("/") | any(bad_segment) | not))
| select((.h | ascii_downcase) == "https://github.com" and (.o | bad_segment | not) and (.n | bad_segment | not))
| "\(.o)/\(.n)" | ascii_downcase) // "?";
.packages[] | . as $pkg | ((.repo // "") | gsub("^\\s+|\\s+$"; "")) as $repo
| select($repo != "") | ($repo | repo_of) as $want
| .versions[] | select(.url | startswith("file://") | not)