fix(og-image): use slug-only path for OG image URL
OG images are served at /og/{slug}.png (e.g. /og/14b61.png),
not with date prefixes. Remove the date segments from the URL
construction in both jf2ToActivityStreams and jf2ToAS2Activity.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+2
-2
@@ -165,7 +165,7 @@ export function jf2ToActivityStreams(properties, actorUrl, publicationUrl, optio
|
||||
if (ogMatch) {
|
||||
object.image = {
|
||||
type: "Image",
|
||||
url: `${publicationUrl.replace(/\/$/, "")}/og/${ogMatch[2]}-${ogMatch[3]}-${ogMatch[4]}-${ogMatch[5]}.png`,
|
||||
url: `${publicationUrl.replace(/\/$/, "")}/og/${ogMatch[5]}.png`,
|
||||
mediaType: "image/png",
|
||||
};
|
||||
}
|
||||
@@ -366,7 +366,7 @@ export function jf2ToAS2Activity(properties, actorUrl, publicationUrl, options =
|
||||
const ogMatchF = postUrl && postUrl.match(/\/([\w-]+)\/(\d{4})\/(\d{2})\/(\d{2})\/([\w-]+)\/?$/);
|
||||
if (ogMatchF) {
|
||||
noteOptions.image = new Image({
|
||||
url: new URL(`${publicationUrl.replace(/\/$/, "")}/og/${ogMatchF[2]}-${ogMatchF[3]}-${ogMatchF[4]}-${ogMatchF[5]}.png`),
|
||||
url: new URL(`${publicationUrl.replace(/\/$/, "")}/og/${ogMatchF[5]}.png`),
|
||||
mediaType: "image/png",
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user