Skip to content

Commit

Permalink
catching trailling slashes on images
Browse files Browse the repository at this point in the history
  • Loading branch information
mansona authored and sivakumar-kailasam committed May 4, 2018
1 parent f1b1157 commit a805b5a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion test/helpers/getBadImageUrls.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const _ = require('lodash');
const checkIfPathExists = require('./checkIfPathExists');

module.exports = function getBadRelativeUrlsForFile(mdFile) {
return _.chain(mdFile.links)
const badImages = _.chain(mdFile.links)
.filter(link => link.endsWith('.png') || link.endsWith('.gif'))
.map((link) => {
// ignore external images
Expand All @@ -24,4 +24,16 @@ module.exports = function getBadRelativeUrlsForFile(mdFile) {
})
.compact()
.value();

const traillingSlashImages = _.chain(mdFile.links)
.filter(link => link.endsWith('.png/') || link.endsWith('.gif/'))
.map(link => ({
fileToFix: mdFile.filepath,
badImageLink: link,
reason: 'extra trailing slash on image',
}))
.compact()
.value();

return _.concat(badImages, traillingSlashImages);
};

0 comments on commit a805b5a

Please sign in to comment.