Skip to content
This repository was archived by the owner on May 21, 2026. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions app/utils/rssHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,16 @@ async function start() {
description = removeHTMLTags(description);
}

let uri = openGraphData.ogUrl ? openGraphData.ogUrl : url;
let uri = openGraphData.ogUrl
? fixMalformedUrl(openGraphData.ogUrl)
: url;

if (openGraphData.ogUrl) {
let regexURL = new RegExp(
`(?:(h|H)(t|T)(t|T)(p|P)(s|):\\/\\/|)[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)`
`^(h|H)(t|T)(t|T)(p|P)(s|S)?:\\/\\/[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)`
);

if (!regexURL.test(openGraphData.ogUrl)) uri = url;
if (!regexURL.test(uri)) uri = url;
}

if (!uri || (!openGraphData.ogTitle && !item.title)) {
Expand Down Expand Up @@ -319,6 +321,14 @@ function decodeHTML(htmlString: string) {
return decode(decode(htmlString));
}

function fixMalformedUrl(urlString: string): string {
// Fix malformed protocols like "https//" or "http//" (missing colon)
// These get treated as relative URLs and cause concatenation bugs
return urlString
.replace(/^https\/\//i, "https://")
.replace(/^http\/\//i, "http://");
}

async function resizeImageToBuffer(bufferData: Buffer) {
try {
const image = await jimp.read(bufferData);
Expand Down