Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug 520994 - Server workspace cannot be "/" (#146)
  • Loading branch information
squarti committed Aug 15, 2017
1 parent 1205def commit 0aad2fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions modules/orionode/lib/api.js
Expand Up @@ -48,8 +48,9 @@ function join(/*varags*/) {
var segment = segs[i];
// This is kind of cheesy: avoid double-slashes
var last = segment.length-1;
path.push(segment[last] === '/' ? segment.substring(0, last) : segment);
// path.push(segment);
if (i > 0 && segment[0] === '/') segment = segment.substring(1);
if (segment[last] === '/') segment = segment.substring(0, last);
path.push(segment);
}
return path.join('/');
}
Expand Down
2 changes: 1 addition & 1 deletion modules/orionode/lib/fileUtil.js
Expand Up @@ -324,7 +324,7 @@ var writeFileMetadata = exports.writeFileMetadata = function(req, res, fileRoot,
function fileJSON(fileRoot, workspaceRoot, file, stats, depth, metadataMixins) {
depth = depth || 0;
var isDir = stats.isDirectory();
var wwwpath = api.toURLPath(file.path.substring(file.workspaceDir.length + 1));
var wwwpath = api.toURLPath(file.path.substring(file.workspaceDir.length));
var result = {
Name: path.basename(file.path),
Location: getFileLocation(fileRoot, wwwpath, isDir),
Expand Down

0 comments on commit 0aad2fa

Please sign in to comment.