Skip to content

Commit a805b5a

Browse files
mansonasivakumar-kailasam
authored andcommitted
catching trailling slashes on images
1 parent f1b1157 commit a805b5a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

test/helpers/getBadImageUrls.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const _ = require('lodash');
33
const checkIfPathExists = require('./checkIfPathExists');
44

55
module.exports = function getBadRelativeUrlsForFile(mdFile) {
6-
return _.chain(mdFile.links)
6+
const badImages = _.chain(mdFile.links)
77
.filter(link => link.endsWith('.png') || link.endsWith('.gif'))
88
.map((link) => {
99
// ignore external images
@@ -24,4 +24,16 @@ module.exports = function getBadRelativeUrlsForFile(mdFile) {
2424
})
2525
.compact()
2626
.value();
27+
28+
const traillingSlashImages = _.chain(mdFile.links)
29+
.filter(link => link.endsWith('.png/') || link.endsWith('.gif/'))
30+
.map(link => ({
31+
fileToFix: mdFile.filepath,
32+
badImageLink: link,
33+
reason: 'extra trailing slash on image',
34+
}))
35+
.compact()
36+
.value();
37+
38+
return _.concat(badImages, traillingSlashImages);
2739
};

0 commit comments

Comments
 (0)