Skip to content

Commit

Permalink
fix(route): get correct item link (DIYgod#17278)
Browse files Browse the repository at this point in the history
When the `href` link inside the element is a relative link, the original handling would obtain an incorrect full link
  • Loading branch information
x1e5c authored Oct 26, 2024
1 parent d79e6cd commit 9916c34
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/routes/rsshub/transform/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ Specify options (in the format of query string) in parameter \`routeParams\` par
} else {
link = linkEle.is('a') ? linkEle.attr('href') : linkEle.find('a').attr('href');
}
// 补全绝对链接
// 补全绝对链接或相对链接
link = link.trim();
if (link && !link.startsWith('http')) {
link = `${new URL(url).origin}${link}`;
link = (new URL(link, url)).href;
}

const descEle = routeParams.get('itemDesc') ? item.find(routeParams.get('itemDesc')) : item;
Expand Down

0 comments on commit 9916c34

Please sign in to comment.