Skip to content

Commit

Permalink
fix(image): Add catching error + log when reading metadataCache for i…
Browse files Browse the repository at this point in the history
…mage
  • Loading branch information
Mara-Li committed Apr 26, 2022
1 parent c44c268 commit 9250e23
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions mkdocsPublisher/utils/publication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,15 @@ export default class MkdocsPublish {
const image_list = []
if (embed_files != undefined) {
for (const embed_file of embed_files) {
const imageLink = this.metadataCache.getFirstLinkpathDest(embed_file.link, file.path)
const imgExt = imageLink.extension
const regImg = /(png|jpe?g|svg|bmp|gif)$/i
if (imgExt.match(regImg)) {
image_list.push(imageLink)
try {
const imageLink = this.metadataCache.getFirstLinkpathDest(embed_file.link, file.path)
const imgExt = imageLink.extension
const regImg = /(png|jpe?g|svg|bmp|gif)$/i
if (imgExt.match(regImg)) {
image_list.push(imageLink)
}
} catch (e) {
console.log('Error with this image : ' + embed_file)
}
}
return image_list
Expand Down

0 comments on commit 9250e23

Please sign in to comment.