fedimbed: replace urlObj when redirecting

This commit is contained in:
Cynthia Foxwell 2022-12-05 20:08:23 -07:00
parent a0a218ce67
commit 86a8bd33a8

View file

@ -29,7 +29,7 @@ const PLATFORM_COLORS = {
const domainCache = new Map();
async function resolvePlatform(url) {
const urlObj = new URL(url);
let urlObj = new URL(url);
if (domainCache.has(urlObj.hostname)) return domainCache.get(urlObj.hostname);
const probe = await fetch(urlObj.origin + "/.well-known/nodeinfo", {
@ -107,6 +107,7 @@ async function processUrl(msg, url) {
if (url.startsWith("/")) {
url = urlObj.origin + url;
}
urlObj = new URL(url);
}
if (PATH_REGEX.pleroma2.test(urlObj.pathname)) {
@ -147,6 +148,8 @@ async function processUrl(msg, url) {
});
}
}
} else {
logger.error("fedimbed", `Redirect from /object did not give us /notice. (${urlObj.pathname})`);
}
} else {
content = postData.content;