fix(routes/lovelive-anime): correct relative img URL resolving (#19916)
This fixes img URL for base url ending with slash (`topics/` or `news/`)
This commit is contained in:
parent
54dae2a0e4
commit
aae0386d9e
|
|
@ -109,12 +109,11 @@ async function handler(ctx) {
|
|||
const pubDate = timezone(parseDate(item.find('a > p.date').text(), 'YYYY/MM/DD'), +9);
|
||||
const title = item.find('a > p.title').text();
|
||||
const category = item.find('a > p.category').text();
|
||||
const imglink = `${rootUrl}/${
|
||||
item
|
||||
.find('a > img')
|
||||
.attr('style')
|
||||
.match(/background-image:url\((.*)\)/)[1]
|
||||
}`;
|
||||
const relativeImgLink = item
|
||||
.find('a > img')
|
||||
.attr('style')
|
||||
.match(/background-image:url\((.*)\)/)[1];
|
||||
const imglink = new URL(relativeImgLink, baseUrl).href;
|
||||
|
||||
return {
|
||||
link,
|
||||
|
|
|
|||
Loading…
Reference in New Issue