mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-10-24 23:42:40 +08:00
fix(route/weibo): add optional chaining for large.geo properties (#19973)
* fix(route/weibo): add optional chaining for `large.geo` properties * fix(route/weibo): add optional chaining for `large.geo` properties * fix(route/weibo): add optional chaining for `large.geo` properties --------- Co-authored-by: NekoAria <NekoAria@users.noreply.github.com>
This commit is contained in:
@@ -157,15 +157,23 @@ const weiboUtils = {
|
||||
let style = '';
|
||||
html += '<img ';
|
||||
html += readable ? 'vspace="8" hspace="4"' : '';
|
||||
if (item.large.geo.width || widthOfPics >= 0) {
|
||||
html += ` width="${item.large.geo.width || widthOfPics}"`;
|
||||
style += `width: ${item.large.geo.width || widthOfPics}px;`;
|
||||
if (item.large) {
|
||||
const { geo, url } = item.large;
|
||||
|
||||
if (geo?.width || widthOfPics >= 0) {
|
||||
const width = geo?.width || widthOfPics;
|
||||
html += ` width="${width}"`;
|
||||
style += `width: ${width}px;`;
|
||||
}
|
||||
|
||||
if (geo?.height || heightOfPics >= 0) {
|
||||
const height = geo?.height || heightOfPics;
|
||||
html += ` height="${height}"`;
|
||||
style += `height: ${height}px;`;
|
||||
}
|
||||
|
||||
html += ` style="${style}" src="${url}">`;
|
||||
}
|
||||
if (item.large.geo.height || heightOfPics >= 0) {
|
||||
html += ` height="${item.large.geo.height || heightOfPics}"`;
|
||||
style += `height: ${item.large.geo.height || heightOfPics}px;`;
|
||||
}
|
||||
html += ` style="${style}"` + ' src="' + item.large.url + '">';
|
||||
|
||||
if (addLinkForPics) {
|
||||
html += '</a>';
|
||||
|
||||
Reference in New Issue
Block a user