Skip to content
This repository has been archived by the owner on Dec 18, 2019. It is now read-only.

Update api.js #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions server/controllers/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ exports.downloadRepository = function(req, res) {
*/
function(files, done) {
return async.map(files, function(file, cb) {
//Convert '/' to '\'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps a correct solution is to instead use something like path.join on the glob above.

Edit: https://github.com/isaacs/node-glob#windows
It looks like glob paths always need to be using forward slashes /, and glob internally returns paths made with path.join. I'm not sure why these slashes need to be converted to work on Windows.

I'm also uncomfortable with a regex based approach like this.

if (file.indexOf('/') > -1) {
file = file.replace(new RegExp('/', 'g'), '\\');
}
return fs.copy(file, file.replace(projectPath, tmpPath), cb);
}, done);
},
Expand Down