Skip to content

Commit 2e975ea

Browse files
authored
Merge pull request #280 from seatable/fix-bug
Fix bug
2 parents 5e8fbce + a146128 commit 2e975ea

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/ImageFormatter/images-lazy-load.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,16 @@ class ImagesLazyLoad extends React.Component {
101101

102102
return (
103103
loadedImages.map((image, index) => {
104-
let imageName = image.slice(image.src.lastIndexOf('/') + 1);
104+
let imageName = '';
105+
const imageSrc = image?.src;
106+
107+
try {
108+
imageName = imageSrc ? decodeURI(imageSrc.slice(imageSrc.lastIndexOf('/') + 1)) : '';
109+
} catch (error) {
110+
// eslint-disable-next-line no-console
111+
console.log(error);
112+
}
113+
105114
const imgDom = (
106115
<img
107116
title={imageName}

0 commit comments

Comments
 (0)