Skip to content

fix: use a term as a prefix only if its name has no colon or slash - #4

Open
jdsika wants to merge 57 commits into
masterfrom
fix/term-with-slash-not-a-prefix
Open

jdsika wants to merge 57 commits into
masterfrom
fix/term-with-slash-not-a-prefix

Conversation

@jdsika

@jdsika jdsika commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Mirror of digitalbazaar#389, which has the description, the reproducer and the review.

dependabot Bot and others added 30 commits November 17, 2026 08:28
Bumps [typer](https://github.com/fastapi/typer) from 0.27.3 to 0.28.0.
- [Release notes](https://github.com/fastapi/typer/releases)
- [Changelog](https://github.com/fastapi/typer/blob/master/docs/release-notes.md)
- [Commits](fastapi/typer@0.27.3...0.28.0)

---
updated-dependencies:
- dependency-name: typer
  dependency-version: 0.28.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.17.3 to 0.17.4.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](astral-sh/ruff@0.17.3...0.17.4)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.17.4
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [cachetools](https://github.com/tkem/cachetools) from 7.2.8 to 7.3.0.
- [Changelog](https://github.com/tkem/cachetools/blob/master/CHANGELOG.rst)
- [Commits](tkem/cachetools@v7.2.8...v7.3.0)

---
updated-dependencies:
- dependency-name: cachetools
  dependency-version: 7.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [specifications/json-ld-api](https://github.com/w3c/json-ld-api) from `92f0770` to `5551473`.
- [Commits](w3c/json-ld-api@92f0770...5551473)

---
updated-dependencies:
- dependency-name: specifications/json-ld-api
  dependency-version: 55514738d854e56bb8bad4c53cda2f0e23be4a50
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
…a path

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
… a path

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
…its query or fragment

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
… query tests

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
remove_dot_segments() added the empty last segment after a final '/.'
or '/..' only at the very end of the string, so it dropped the '/' when
a '?' or '#' followed: '/abc/def/./ghi/../..#abc' gave '/abc#abc'
instead of '/abc/#abc' (RFC 3986, section 5.2.4). resolve() worked
around this for relative paths only, so absolute IRIs and network-path
references still lost the '/' ('http://abc/def/.?x' gave
'http://abc/def?x').

Add the empty last segment whenever the dot segment is not followed by
another '/'. This is the same fix as relative-to-absolute-iri.js#33.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
resolve() split the reference at its first '?' or '#' so that
remove_dot_segments() would not drop the '/' of a final dot segment.
remove_dot_segments() now keeps it, so the split is no longer needed.
This changes no result.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Since the query of the base IRI is dropped before the scheme check, a
base IRI such as 'def?x:y' has no scheme left and raises a ValueError
for a path reference, as a base IRI without any ':' does.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
jdsika and others added 24 commits November 18, 2026 16:52
The fix now lives in remove_dot_segments(), so it applies to every
reference, including absolute IRIs and network-path references.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
…ive IRI

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
…ative

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
…gments

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
…elog entry

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
'//h/a:b/.?q' against 'http://x/' and 'z/a:b/.?' against 'urn:x' lost
the '/' of the final dot segment on this branch before it built on
pyld#372, the same regression that relative-to-absolute-iri.js#34 had.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
After the scheme check, value_colon_pos was always -1, so pass -1 to
remove_dot_segments_of_path() directly. Find the start of the path
with one find() and a check for '?' or '#' before it, and document
colon_position as the ':' that ends the scheme, or -1. This changes no
result. It matches relative-to-absolute-iri.js#34.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
…s does

Port the two cases of relative-to-absolute-iri.js#33 and digitalbazaar#34 that had
no twin here: '/a:b/../c' against 'http://base.org' and 'x/./y:z'
against 'tag:example'.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Without a base IRI, such a reference is still returned unchanged, as
in relative-to-absolute-iri.js.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Co-authored-by: Miel Vander Sande <miel.vandersande@meemoo.be>
Co-authored-by: Miel Vander Sande <miel.vandersande@meemoo.be>
Bumps [cachetools](https://github.com/tkem/cachetools) from 7.3.0 to 7.3.2.
- [Changelog](https://github.com/tkem/cachetools/blob/master/CHANGELOG.rst)
- [Commits](tkem/cachetools@v7.3.0...v7.3.2)

---
updated-dependencies:
- dependency-name: cachetools
  dependency-version: 7.3.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.17.4 to 0.17.5.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](astral-sh/ruff@0.17.4...0.17.5)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.17.5
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [specifications/json-ld-api](https://github.com/w3c/json-ld-api) from `5551473` to `a1732db`.
- [Commits](w3c/json-ld-api@5551473...a1732db)

---
updated-dependencies:
- dependency-name: specifications/json-ld-api
  dependency-version: a1732db52b10222a7c39e79dc93b12f3b873ebfd
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [specifications/rdf-canon](https://github.com/w3c/rdf-canon) from `15619df` to `5ffaaa1`.
- [Commits](w3c/rdf-canon@15619df...5ffaaa1)

---
updated-dependencies:
- dependency-name: specifications/rdf-canon
  dependency-version: 5ffaaa13c0e19a2a2f9e60d0ecd9efaf3edab633
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Coverage

Coverage Report
FileStmtsMissCoverMissing
lib/pyld
   canon.py2901296%36, 47, 51, 55, 85–86, 530, 552, 616, 626, 680–681
   context_resolver.py103892%78, 137, 151, 197, 203–205, 229
   iri_resolver.py140398%313–314, 324
   jsonld.py251316394%252–256, 305, 342, 347, 357, 374–389, 425–426, 468, 476, 496, 504–505, 613–618, 701–702, 717–718, 781–786, 811–812, 827–828, 838–839, 865, 913, 927–928, 951–952, 994, 1001, 1008, 1076, 1101, 1123–1125, 1135–1138, 1153, 1176, 1188–1191, 1287, 1296–1299, 1319, 1348, 1381, 1385, 1419, 1436–1438, 1448–1450, 1493, 1512–1515, 1528, 1577, 1680–1687, 1714–1716, 1742–1745, 1921, 1959, 2265, 2396, 2405–2412, 2506, 2533, 2557, 2565, 3159, 3209, 3228, 3293, 3346, 3349, 3412, 3497, 3531, 3818, 3823, 3825, 4020–4022, 4165, 4228, 4467, 4755, 4887, 4921, 4950–4953, 4975–4976, 5159, 5223, 5250, 5324, 5326, 5344, 5441, 5490, 5722, 5724, 5763, 5765, 5774, 5919, 6047, 6134, 6254–6268, 6402, 6668, 6674–6678, 6717, 6720, 6810–6811, 6820
   util.py72396%43, 116, 136
lib/pyld/cli
   app.py44295%77, 80
   entry.py12375%9–11, 24
   input.py52198%57
lib/pyld/documentloader
   aiohttp.py712269%29–39, 68, 74, 86, 98–106, 118–121, 138, 153–156
   file.py36197%49
   requests.py52590%57, 71, 83–91
   requests_sqlite_cache.py25196%19
   scheme_directed.py15193%38
   type_directed.py15193%41
TOTAL379622694% 

Tests Skipped Failures Errors Time
1998 28 💤 0 ❌ 0 🔥 3m 5s ⏱️

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants