File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ var _ = require('lodash');
66function urlForHelper ( path , options ) {
77 path = path || '/' ;
88
9+ if ( path [ 0 ] === '#' || path . substring ( 0 , 2 ) === '//' ) {
10+ return path ;
11+ }
12+
913 var config = this . config ;
1014 var root = config . root ;
1115 var data = url . parse ( path ) ;
@@ -15,7 +19,7 @@ function urlForHelper(path, options) {
1519 } , options ) ;
1620
1721 // Exit if this is an external path
18- if ( data . protocol || path . substring ( 0 , 2 ) === '//' ) {
22+ if ( data . protocol ) {
1923 return path ;
2024 }
2125
Original file line number Diff line number Diff line change @@ -52,4 +52,8 @@ describe('url_for', function() {
5252 urlFor ( url ) . should . eql ( url ) ;
5353 } ) ;
5454 } ) ;
55+
56+ it ( 'only hash' , function ( ) {
57+ urlFor ( '#test' ) . should . eql ( '#test' ) ;
58+ } ) ;
5559} ) ;
You can’t perform that action at this time.
0 commit comments