Skip to content

Commit 0fdf88b

Browse files
feat: ignore media properties
1 parent 6678217 commit 0fdf88b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/fetch-references.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { mf2tojf2 } from "../index.js";
22
import { fetchMf2 } from "./fetch-mf2.js";
33

4+
const ignoredProperties = new Set(["audio", "photo", "url", "video"]);
5+
46
/**
57
* Get a list of URLs that can be referenced
68
* @private
@@ -16,7 +18,7 @@ const referenceableUrls = (jf2) => {
1618
const referenceableProperty =
1719
typeof value === "string" &&
1820
URL.canParse(value) &&
19-
key !== "url" &&
21+
!ignoredProperties.has(key) &&
2022
!key.startsWith("mp-");
2123

2224
if (referenceableProperty) {

test/fetch-references.js

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ describe("mf2tojf2", () => {
1212
type: "entry",
1313
name: "What my friend ate for lunch yesterday",
1414
published: "2019-02-12T10:00:00.000+00:00",
15+
photo: "https://website.example/photo.jpg",
1516
category: ["foo", "bar"],
1617
url: "https://website.example/bookmarks/lunch",
1718
"bookmark-of": "https://another.example/notes/lunch",
@@ -22,6 +23,7 @@ describe("mf2tojf2", () => {
2223
type: "entry",
2324
name: "What my friend ate for lunch yesterday",
2425
published: "2019-02-12T10:00:00.000+00:00",
26+
photo: "https://website.example/photo.jpg",
2527
category: ["foo", "bar"],
2628
url: "https://website.example/bookmarks/lunch",
2729
"bookmark-of": "https://another.example/notes/lunch",

0 commit comments

Comments
 (0)