fix: encode custom identifiers in LabelBox staging URLs

AF
9h ago
+72-1

Summary

LabelBox staging uses each external ID as a local filename and appends that filename directly to the data URL. An ID such as chapter#one produces a URL fragment instead of part of the filename. Literal percent sequences such as value%2Fpart or value%25part are decoded as different filenames by the server. The generated configuration therefore points to a missing object even though staging wrote the correct file.

Percent-encode the filename as a URL path component. Keep the local filename and externalId unchanged, and retain the already-encoded URL prefix. UUIDs and other unreserved identifiers produce the same URLs as before.

This addresses URL construction; the separate file-encoding proposal in #4456 is not part of this change.

Validation

  • The 14 new cases produce 12 failures and 2 passing controls on the original source. The final source plus the existing LabelBox suite reports 27 passed on Python 3.12.
  • Tests serve the actual staged files with Python's HTTP server and fetch each generated URL with Requests. Hash signs and literal percent sequences return HTTP 404 before the fix; the corrected URLs return HTTP 200 and the exact source text.
  • Cases also cover spaces, Unicode identifiers, brackets, trailing slashes, an already-encoded prefix, stable external IDs and unchanged unreserved/default identifiers.
  • Repository-configured Ruff check, format check and before/after source-integrity checks pass.
  • Validation run, exact commands and JUnit artifacts.

Checklist

  • User-facing conventional-commit title.
  • Maintainer: please apply the bug category label.