Skip to content

Commit

Permalink
Fix Windows absolute path check using forward slashes
Browse files Browse the repository at this point in the history
closes #3017
  • Loading branch information
huaoguo authored and dougwilson committed Jun 1, 2016
1 parent 999546d commit 2e1284b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
unreleased
==========

* Fix Windows absolute path check using forward slashes
* Improve performance for `res.json`/`res.jsonp` in most cases
* deps: accepts@~1.3.3
- Fix including type extensions in parameters in `Accept` parsing
Expand Down
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ exports.wetag = function wetag(body, encoding){

exports.isAbsolute = function(path){
if ('/' === path[0]) return true;
if (':' === path[1] && '\\' === path[2]) return true;
if (':' === path[1] && ('\\' === path[2] || '/' === path[2])) return true; // Windows device path
if ('\\\\' === path.substring(0, 2)) return true; // Microsoft Azure absolute path
};

Expand Down
1 change: 1 addition & 0 deletions test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ describe('utils.wetag(body, encoding)', function(){
describe('utils.isAbsolute()', function(){
it('should support windows', function(){
assert(utils.isAbsolute('c:\\'));
assert(utils.isAbsolute('c:/'));
assert(!utils.isAbsolute(':\\'));
})

Expand Down

0 comments on commit 2e1284b

Please sign in to comment.