Skip to content

Commit 26a2c74

Browse files
committed
Escape attributes in lightbox image
Signed-off-by: Yukai Huang <yukaihuangtw@gmail.com>
1 parent 381b3ff commit 26a2c74

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

public/js/lib/renderer/lightbox/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import './lightbox.css'
2+
import escape from 'lodash/escape'
23

34
let images = []
45
/** @type {HTMLImageElement} */
@@ -74,7 +75,7 @@ function setImageInner (img, lightBoxContainer) {
7475
const src = img.getAttribute('src')
7576
const alt = img.getAttribute('alt')
7677

77-
lightBoxContainer.querySelector('.lightbox-inner').innerHTML = `<img src="${src}" alt="${alt}" draggable="false">`
78+
lightBoxContainer.querySelector('.lightbox-inner').innerHTML = `<img src="${escape(src)}" alt="${escape(alt)}" draggable="false">`
7879
addImageDragListener(lightBoxContainer.querySelector('.lightbox-inner img'))
7980
}
8081

0 commit comments

Comments
 (0)