File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -19,10 +19,13 @@ class UrlBuilder {
1919 if ( ! this . absolute )
2020 return '/' ;
2121
22+ if ( ! this . route . domain )
23+ return Ziggy . baseUrl . replace ( / \/ ? $ / , '/' ) ;
24+
2225 let host = ( this . route . domain || Ziggy . baseDomain ) . replace ( / \/ + $ / , '' ) ;
2326
2427 if ( Ziggy . basePort && ( host . replace ( / \/ + $ / , '' ) === Ziggy . baseDomain . replace ( / \/ + $ / , '' ) ) )
25- host = host + ':' + Ziggy . basePort ;
28+ host = Ziggy . baseDomain + ':' + Ziggy . basePort ;
2629
2730 return Ziggy . baseProtocol + '://' + host + '/' ;
2831 }
Original file line number Diff line number Diff line change @@ -300,5 +300,15 @@ describe('route()', function() {
300300 'events.venues.index' ,
301301 route ( ) . current ( )
302302 ) ;
303- } )
303+ } ) ;
304+
305+ it ( 'Should still work if paths are appended to baseUrl.' , function ( ) {
306+ let orgBaseUrl = Ziggy . baseUrl ;
307+ global . Ziggy . baseUrl = 'http://test.thing/ab/cd/' ;
308+
309+ assert . equal (
310+ 'http://test.thing/ab/cd/events/1/venues' ,
311+ route ( 'events.venues.index' , 1 )
312+ ) ;
313+ } ) ;
304314} ) ;
You can’t perform that action at this time.
0 commit comments