File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -147,16 +147,17 @@ export const parseURL = function(
147
147
domain = 'localhost' ;
148
148
}
149
149
// Support `ns` query param if subdomain not already set
150
- if ( subdomain === '' ) {
151
- const queryStartIndex = host . indexOf ( '?' ) ;
152
- if ( queryStartIndex != - 1 ) {
150
+ const queryStartIndex = host . indexOf ( '?' ) ;
151
+ if ( queryStartIndex > 0 ) {
152
+ if ( subdomain === '' ) {
153
153
const queryString = host . substring ( queryStartIndex , host . length ) ;
154
154
const match = queryString . match ( / n s = ( [ a - z A - Z 0 - 9 - ] + ) / ) ;
155
155
if ( match . length > 0 ) {
156
156
subdomain = match [ 1 ] ;
157
- host = host . substring ( 0 , queryStartIndex ) ;
158
157
}
159
158
}
159
+ // Always remove all query params from the host
160
+ host = host . substring ( 0 , queryStartIndex ) ;
160
161
}
161
162
}
162
163
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ describe('Database Tests', function() {
87
87
var db = defaultApp . database ( 'http://bar.firebaseio.com?ns=foo' ) ;
88
88
expect ( db ) . to . be . ok ;
89
89
expect ( db . repo_ . repoInfo_ . namespace ) . to . equal ( 'bar' ) ;
90
- expect ( db . ref ( ) . toString ( ) ) . to . equal ( 'https://bar.firebaseio.com?ns=foo /' ) ;
90
+ expect ( db . ref ( ) . toString ( ) ) . to . equal ( 'https://bar.firebaseio.com/' ) ;
91
91
} ) ;
92
92
93
93
it ( 'Different instances for different URLs' , function ( ) {
You can’t perform that action at this time.
0 commit comments