Skip to content
This repository has been archived by the owner on Jan 13, 2018. It is now read-only.

Commit

Permalink
0.5.25
Browse files Browse the repository at this point in the history
  • Loading branch information
scf2k committed Feb 14, 2013
2 parents ea9ba42 + 00f3f27 commit 69ccbd6
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 3 deletions.
5 changes: 5 additions & 0 deletions ChangeLog.md
@@ -1,5 +1,10 @@
bem-tools changelog
===================
14.02.2013, Version 0.5.25 (stable)
-----------------------------------

- bem server: windows fixes

04.02.2013, Version 0.5.24 (stable)
-----------------------------------

Expand Down
2 changes: 2 additions & 0 deletions lib/base-server.js
Expand Up @@ -150,6 +150,8 @@ exports.Server = INHERIT({
relPath = QS.unescape(reqPath).replace(/^\/|\/$/g, ''),
fullPath = PATH.join(root, relPath);

if (PATH.dirSep === '\\') relPath = PATH.unixToOs(relPath);

LOGGER.fverbose('*** trying to access %s', fullPath);

// try to find node in arch
Expand Down
2 changes: 1 addition & 1 deletion lib/nodes/lib.js
Expand Up @@ -453,6 +453,6 @@ registry.decl(SvnLibraryNodeName, ScmLibraryNodeName, /** @lends SvnLibraryNode.

function joinUrlPath(url, part) {
var p = URL.parse(url);
p.pathname = PATH.join(p.pathname, part);
p.pathname = PATH.joinPosix(p.pathname, part);
return URL.format(p);
}
52 changes: 52 additions & 0 deletions lib/path.js
Expand Up @@ -27,6 +27,58 @@ exports.unixToOs = function(path) {
return path.replace(/\//g, dirSep);
};

exports.joinPosix = function() {
var paths = Array.prototype.slice.call(arguments, 0);
return exports.normalizePosix(paths.filter(function(p, index) {
return p && typeof p === 'string';
}).join('/'));
};

exports.normalizePosix = function(path) {
var isAbsolute = path.charAt(0) === '/',
trailingSlash = path.slice(-1) === '/';

// Normalize the path
path = normalizeArray(path.split('/').filter(function(p) {
return !!p;
}), !isAbsolute).join('/');

if (!path && !isAbsolute) {
path = '.';
}
if (path && trailingSlash) {
path += '/';
}

return (isAbsolute ? '/' : '') + path;
};

// Support compatability with node 0.6.x and remove warnings on node 0.8.x
exports.exists = FS.exists || PATH.exists;
exports.existsSync = FS.existsSync || PATH.existsSync;

function normalizeArray(parts, allowAboveRoot) {
// if the path tries to go above the root, `up` ends up > 0
var up = 0;
for (var i = parts.length - 1; i >= 0; i--) {
var last = parts[i];
if (last == '.') {
parts.splice(i, 1);
} else if (last === '..') {
parts.splice(i, 1);
up++;
} else if (up) {
parts.splice(i, 1);
up--;
}
}

// if the path is allowed to go above the root, restore leading ..s
if (allowAboveRoot) {
for (; up--; up) {
parts.unshift('..');
}
}

return parts;
}
2 changes: 1 addition & 1 deletion npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "bem",
"description": "BEM Tools",
"version": "0.5.24",
"version": "0.5.25",
"homepage": "http://github.com/bem/bem-tools",
"author": "Sergey Berezhnoy <veged@mail.ru> (http://github.com/veged)",
"maintainers": [
Expand Down

0 comments on commit 69ccbd6

Please sign in to comment.