cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhigg...@apache.org
Subject git commit: [CB-4372] Fixed "Plugman fails when fetching local plugins with space in path"
Date Wed, 24 Jul 2013 20:59:10 GMT
Updated Branches:
  refs/heads/master bdf4d061b -> 2a8b9add0


[CB-4372] Fixed "Plugman fails when fetching local plugins with space in path"


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/2a8b9add
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/2a8b9add
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/2a8b9add

Branch: refs/heads/master
Commit: 2a8b9add0f7fb2d98a172cba404203772e65d951
Parents: bdf4d06
Author: jkeshavarzi <jkeshavarzi@blackberry.com>
Authored: Wed Jul 24 16:04:50 2013 -0400
Committer: Bryan Higgins <bhiggins@blackberry.com>
Committed: Wed Jul 24 16:59:44 2013 -0400

----------------------------------------------------------------------
 spec/fetch.spec.js | 5 +++++
 src/fetch.js       | 4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/2a8b9add/spec/fetch.spec.js
----------------------------------------------------------------------
diff --git a/spec/fetch.spec.js b/spec/fetch.spec.js
index 1fc1aaf..4151020 100644
--- a/spec/fetch.spec.js
+++ b/spec/fetch.spec.js
@@ -7,6 +7,7 @@ var fetch   = require('../src/fetch'),
     metadata = require('../src/util/metadata'),
     temp    = path.join(os.tmpdir(), 'plugman'),
     test_plugin = path.join(__dirname, 'plugins', 'ChildBrowser'),
+    test_plugin_with_space = path.join(__dirname, 'folder with space', 'plugins', 'ChildBrowser'),
     plugins = require('../src/util/plugins');
 
 describe('fetch', function() {
@@ -26,6 +27,10 @@ describe('fetch', function() {
             fetch(test_plugin, temp);
             expect(cp).toHaveBeenCalledWith('-R', path.join(test_plugin, '*'), path.join(temp,
'id'));
         });
+        it('should copy locally-available plugin to plugins directory when spaces in path',
function() {
+            fetch(test_plugin_with_space, temp);
+            expect(cp).toHaveBeenCalledWith('-R', path.join(test_plugin_with_space, '*'),
path.join(temp, 'id'));
+        });
         it('should create a symlink if used with `link` param', function() {
             fetch(test_plugin, temp, { link: true });
             expect(sym).toHaveBeenCalledWith(test_plugin, path.join(temp, 'id'), 'dir');

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/2a8b9add/src/fetch.js
----------------------------------------------------------------------
diff --git a/src/fetch.js b/src/fetch.js
index 28d9994..e2b3d71 100644
--- a/src/fetch.js
+++ b/src/fetch.js
@@ -46,7 +46,9 @@ module.exports = function fetchPlugin(plugin_dir, plugins_dir, options,
callback
 
         // Copy from the local filesystem.
         // First, read the plugin.xml and grab the ID.
-        plugin_dir = path.join(uri.href, options.subdir);
+        // NOTE: Can't use uri.href here as it will convert spaces to %20 and make path invalid.
+        // Use original plugin_dir value instead.
+        plugin_dir = path.join(plugin_dir, options.subdir);
         var plugin_xml_path = path.join(plugin_dir, 'plugin.xml');
         require('../plugman').emit('log', 'Fetch is reading plugin.xml from location "' +
plugin_xml_path + '"...');
         var xml = xml_helpers.parseElementtreeSync(plugin_xml_path);


Mime
View raw message