File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
packages/database/src/core/util/libs Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -174,16 +174,17 @@ export const parseDatabaseURL = function(
174
174
colonInd = dataURL . length ;
175
175
}
176
176
177
- if ( host . slice ( 0 , colonInd ) . toLowerCase ( ) === 'localhost' ) {
177
+ const hostWithoutPort = host . slice ( 0 , colonInd ) ;
178
+ if ( hostWithoutPort . toLowerCase ( ) === 'localhost' ) {
178
179
domain = 'localhost' ;
180
+ } else if ( hostWithoutPort . split ( '.' ) . length <= 2 ) {
181
+ domain = hostWithoutPort ; // Domain is at least 2 parts.
179
182
} else {
180
183
const dotInd = host . indexOf ( '.' ) ;
181
- if ( dotInd !== - 1 ) {
182
- // Normalize namespaces to lowercase to share storage / connection.
183
- subdomain = host . substring ( 0 , dotInd ) . toLowerCase ( ) ;
184
- namespace = subdomain ;
185
- domain = host . substring ( dotInd + 1 ) ;
186
- }
184
+ domain = host . substring ( dotInd + 1 ) ;
185
+ subdomain = host . substring ( 0 , dotInd ) . toLowerCase ( ) ;
186
+ // Normalize namespaces to lowercase to share storage / connection.
187
+ namespace = subdomain ;
187
188
}
188
189
// Always treat the value of the `ns` as the namespace name if it is present.
189
190
if ( 'ns' in queryParams ) {
You can’t perform that action at this time.
0 commit comments