Skip to content

Commit

Permalink
closes #14
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan de Jong committed May 6, 2017
1 parent 23cb79d commit cee97ea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Expand Up @@ -5,7 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
Nothing notable at the moment.
### Fixed
- Installing nodepacks through the editor or via `xiblepm nodepack install` now works on Windows.

## [0.4.0] - 2017-04-30
### Added
Expand Down
13 changes: 10 additions & 3 deletions app/Registry/index.js
Expand Up @@ -48,7 +48,13 @@ module.exports = (XIBLE, EXPRESS_APP) => {
}

return this.getTarballUrl().then(tarballUrl => new Promise((resolve, reject) => {
// clean the dir
// check if the tarbalUrl is safe
if (encodeURI(tarballUrl) !== tarballUrl) {
reject(new Error('Package URL contains potentially unsafe characters'));
return;
}

// clean the tmp dir where we will download the npm package
fsExtra.emptyDir(TMP_REGISTRY_DIR, (err) => {
if (err) {
reject(err);
Expand All @@ -68,10 +74,11 @@ module.exports = (XIBLE, EXPRESS_APP) => {
return;
}

// fork an npm to install the registry url
// fork npm to install the registry url
const fork = require('child_process').spawn;
const npm = fork('npm', ['install', tarballUrl], {
cwd: TMP_REGISTRY_DIR
cwd: TMP_REGISTRY_DIR,
shell: true
});

npm.on('error', npmErr => reject(npmErr));
Expand Down

0 comments on commit cee97ea

Please sign in to comment.