From 538073f391937370ad1a7ae07753ed0c4c99637a Mon Sep 17 00:00:00 2001 From: marco4net Date: Wed, 26 Aug 2015 20:22:54 +0200 Subject: [PATCH 1/3] Prevent adding directories as script references --- tasks/scriptlinker.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tasks/scriptlinker.js b/tasks/scriptlinker.js index 7402780..8e854d1 100644 --- a/tasks/scriptlinker.js +++ b/tasks/scriptlinker.js @@ -40,7 +40,13 @@ module.exports = function(grunt) { if (!grunt.file.exists(filepath)) { grunt.log.warn('Source file "' + filepath + '" not found.'); return false; - } else { return true; } + } + if (grunt.file.isDir(filepath)) { + grunt.verbose.warn('Ignoring directory "' + filepath + '" even though matching pattern.'); + return false; + } else { + return true; + } }).map(function (filepath) { filepath = filepath.replace(options.appRoot, ''); // If "relative" option is set, remove initial forward slash from file path From c4576f197306d919366bdcd348b3bd3e859e94ff Mon Sep 17 00:00:00 2001 From: marco4net Date: Wed, 26 Aug 2015 20:46:58 +0200 Subject: [PATCH 2/3] Adding test case for directory with matching pattern. --- test/fixtures/sails.io.js/.gitignore | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 test/fixtures/sails.io.js/.gitignore diff --git a/test/fixtures/sails.io.js/.gitignore b/test/fixtures/sails.io.js/.gitignore new file mode 100644 index 0000000..86d0cb2 --- /dev/null +++ b/test/fixtures/sails.io.js/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore \ No newline at end of file From 04138e77b34d43f1539d9f7ace5bb26ae1b3b4c5 Mon Sep 17 00:00:00 2001 From: marco4net Date: Wed, 26 Aug 2015 20:57:38 +0200 Subject: [PATCH 3/3] Adding missing newline --- test/fixtures/sails.io.js/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fixtures/sails.io.js/.gitignore b/test/fixtures/sails.io.js/.gitignore index 86d0cb2..5e7d273 100644 --- a/test/fixtures/sails.io.js/.gitignore +++ b/test/fixtures/sails.io.js/.gitignore @@ -1,4 +1,4 @@ # Ignore everything in this directory * # Except this file -!.gitignore \ No newline at end of file +!.gitignore