Spaces:
Build error
Build error
fix: img with srcset only
Browse files
backend/functions/src/services/snapshot-formatter.ts
CHANGED
|
@@ -230,6 +230,10 @@ export class SnapshotFormatter extends AsyncService {
|
|
| 230 |
return alt ? `(Image ${++imgIdx}: ${alt})` : '';
|
| 231 |
}
|
| 232 |
let linkPreferredSrc = (node.getAttribute('src') || '').trim();
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
if (!linkPreferredSrc || linkPreferredSrc.startsWith('data:')) {
|
| 234 |
const dataSrc = (node.getAttribute('data-src') || '').trim();
|
| 235 |
if (dataSrc && !dataSrc.startsWith('data:')) {
|
|
|
|
| 230 |
return alt ? `(Image ${++imgIdx}: ${alt})` : '';
|
| 231 |
}
|
| 232 |
let linkPreferredSrc = (node.getAttribute('src') || '').trim();
|
| 233 |
+
const maybeSrcSet: string = (node.getAttribute('srcset') || '').trim();
|
| 234 |
+
if (!linkPreferredSrc && maybeSrcSet) {
|
| 235 |
+
linkPreferredSrc = maybeSrcSet.split(',').map((x) => x.trim()).filter(Boolean)[0];
|
| 236 |
+
}
|
| 237 |
if (!linkPreferredSrc || linkPreferredSrc.startsWith('data:')) {
|
| 238 |
const dataSrc = (node.getAttribute('data-src') || '').trim();
|
| 239 |
if (dataSrc && !dataSrc.startsWith('data:')) {
|