diff --git a/build/check-images.js b/build/check-images.js index 46946c23cdd1..be45b75f8990 100644 --- a/build/check-images.js +++ b/build/check-images.js @@ -86,7 +86,7 @@ function checkImageReferences(doc, $, options, { url, rawContent }) { // a new function dedicated to that. let finalSrc = null; - if (!src.trim()) { + if (!src.split("#")[0].trim()) { if (checkImages) { addImageFlaw(img, src, { explanation: "Empty img 'src' attribute", diff --git a/testing/content/files/en-us/web/empty_image/index.html b/testing/content/files/en-us/web/empty_image/index.html index 5af0d10f280a..750bdd866dbc 100644 --- a/testing/content/files/en-us/web/empty_image/index.html +++ b/testing/content/files/en-us/web/empty_image/index.html @@ -8,3 +8,10 @@ Pretty nihilistic, eh?

+ +

+ This one is based on make sure we've solved: + issue#3186 +

+ + diff --git a/testing/tests/index.test.js b/testing/tests/index.test.js index 101baeae0722..7ef9f7198e44 100644 --- a/testing/tests/index.test.js +++ b/testing/tests/index.test.js @@ -970,12 +970,17 @@ test("img tags with an empty 'src' should be a flaw", () => { expect(fs.existsSync(builtFolder)).toBeTruthy(); const jsonFile = path.join(builtFolder, "index.json"); const { doc } = JSON.parse(fs.readFileSync(jsonFile)); - expect(doc.flaws.images.length).toBe(1); + expect(doc.flaws.images.length).toBe(2); expect(doc.flaws.images[0].explanation).toBe("Empty img 'src' attribute"); expect(doc.flaws.images[0].fixable).toBeFalsy(); expect(doc.flaws.images[0].externalImage).toBeFalsy(); expect(doc.flaws.images[0].line).toBe(8); expect(doc.flaws.images[0].column).toBe(13); + expect(doc.flaws.images[1].explanation).toBe("Empty img 'src' attribute"); + expect(doc.flaws.images[1].fixable).toBeFalsy(); + expect(doc.flaws.images[1].externalImage).toBeFalsy(); + expect(doc.flaws.images[1].line).toBe(17); + expect(doc.flaws.images[1].column).toBe(11); }); test("img with the image_widths flaw", () => {