w0rm/gulp-svgstore

does not work properly with null files

tmorozov opened this issue · 2 comments

version "gulp-svgstore": "~5.0.3"

error:
file.cheerio = cheerio.load(file.contents.toString(), { xmlMode: true })
TypeError: Cannot call method 'toString' of null

quick fix:
add

    if (file.isNull()) {
      return cb(null, file);
    }

before

    if (!file.cheerio) {
      file.cheerio = cheerio.load(file.contents.toString(), { xmlMode: true })
    }
w0rm commented

Hi @tmorozov. A pull request with this change and a test for it is very welcome. By the way, we also dont check for the wrong file format, assuming the correct input.

w0rm commented

I also think that we should probably ignore such files and remove them from the downstream. However I'm open to discuss this matter