@fedify/vocab 2.4.0-dev.1508 → 2.4.0-dev.1528

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab",
3
- "version": "2.4.0-dev.1508+68519bf4",
3
+ "version": "2.4.0-dev.1528+fea670ad",
4
4
  "homepage": "https://fedify.dev/",
5
5
  "repository": {
6
6
  "type": "git",
@@ -43,9 +43,9 @@
43
43
  "es-toolkit": "1.46.1",
44
44
  "jsonld": "^9.0.0",
45
45
  "pkijs": "^3.3.3",
46
- "@fedify/webfinger": "2.4.0-dev.1508+68519bf4",
47
- "@fedify/vocab-runtime": "2.4.0-dev.1508+68519bf4",
48
- "@fedify/vocab-tools": "2.4.0-dev.1508+68519bf4"
46
+ "@fedify/vocab-tools": "2.4.0-dev.1528+fea670ad",
47
+ "@fedify/webfinger": "2.4.0-dev.1528+fea670ad",
48
+ "@fedify/vocab-runtime": "2.4.0-dev.1528+fea670ad"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/node": "^22.17.0",
package/src/lookup.ts CHANGED
@@ -2,6 +2,8 @@ import type { GetUserAgentOptions } from "@fedify/vocab-runtime";
2
2
  import {
3
3
  type DocumentLoader,
4
4
  getDocumentLoader,
5
+ haveSameIriOrigin,
6
+ parseIri,
5
7
  type RemoteDocument,
6
8
  } from "@fedify/vocab-runtime";
7
9
  import { lookupWebFinger } from "@fedify/webfinger";
@@ -312,12 +314,14 @@ async function lookupObjectInternal(
312
314
  }
313
315
  if (remoteDoc == null) return null;
314
316
  let object: Object;
317
+ let documentUrl: URL;
315
318
  try {
319
+ documentUrl = parseIri(remoteDoc.documentUrl);
316
320
  object = await Object.fromJsonLd(remoteDoc.document, {
317
321
  documentLoader,
318
322
  contextLoader: options.contextLoader,
319
323
  tracerProvider: options.tracerProvider,
320
- baseUrl: new URL(remoteDoc.documentUrl),
324
+ baseUrl: documentUrl,
321
325
  });
322
326
  } catch (error) {
323
327
  if (error instanceof TypeError) {
@@ -331,7 +335,7 @@ async function lookupObjectInternal(
331
335
  }
332
336
  if (
333
337
  options.crossOrigin !== "trust" && object.id != null &&
334
- object.id.origin !== new URL(remoteDoc.documentUrl).origin
338
+ !haveSameIriOrigin(object.id, documentUrl)
335
339
  ) {
336
340
  if (options.crossOrigin === "throw") {
337
341
  throw new Error(