updated regex for img and video tag removal one more time...

This commit is contained in:
dylan 2025-12-28 21:22:42 +00:00
parent 5c78a8a491
commit ad10100c02
2 changed files with 3 additions and 3 deletions

View file

@ -135,7 +135,7 @@ export default async function now() {
} else {
// remove img tags if no image available (handle multi-line tags and any attribute order)
newNow = newNow.replace(
new RegExp(`<img\\b[^>]*\\bsrc=["']${imageId}["'][^>]*>`, 'gis'),
new RegExp(`\\s*<img\\b[^>]*\\bsrc=["']${imageId}["'][^>]*>\\s*`, 'gis'),
'',
)
// remove markdown image
@ -154,7 +154,7 @@ export default async function now() {
} else {
// remove video tags if no video available
newNow = newNow.replace(
new RegExp(`<video\\b[^>]*\\bsrc=["']${videoId}["'][^>]*>[\\s\\S]*?</video>`, 'gis'),
new RegExp(`\\s*<video\\b[^>]*\\bsrc=["']${videoId}["'][^>]*>[\\s\\S]*?</video>\\s*`, 'gis'),
'',
)
}

View file

@ -53,7 +53,7 @@
<div
style="background: rgba(148, 226, 213, 0.15); padding: 1rem; border: 4px solid #94e2d5; color:white; display: flex; justify-content: space-between; align-items: center;">
<div style="text-align: left;">
I shared this photo<br>
<i class="fa-regular fa-images"></i>I shared this photo<br>
<a href="https://dylan.some.pics" style="color: #94e2d5 !important;">some.pics</a>
</div>
<img src="some.pics-image" style="max-width: 120px; max-height: 120px; object-fit: cover; border-radius: 4px;">