fix(feeds.js): add require length attribute to enclosures with correct value

This commit is contained in:
Cory Dransfeldt 2025-04-11 16:40:44 -07:00
parent 995202b1d6
commit 2dc119415d
No known key found for this signature in database
4 changed files with 30 additions and 18 deletions

View file

@ -24,5 +24,16 @@ export default {
generatePermalink: (url, baseUrl) => {
if (url?.includes("http") || !baseUrl) return url
return `${baseUrl}${url}`
},
getRemoteFileSize: async (url) => {
try {
const response = await fetch(url, { method: "HEAD" });
if (!response.ok) return 0;
const contentLength = response.headers.get("content-length");
if (!contentLength) return 0;
return parseInt(contentLength, 10);
} catch (error) {
return 0;
}
}
}