mirror of
https://github.com/dzeiocom/libs.git
synced 2025-06-16 04:29:21 +00:00
Fixed Path not correctly compiling with only a protocol
Signed-off-by: Florian Bouillon <florian.bouillon@delta-wings.net>
This commit is contained in:
@ -32,7 +32,13 @@ export default class URLManager {
|
||||
|
||||
private fromURL(url: string) {
|
||||
const protocolIndex = url.indexOf('://')
|
||||
const indexOfPath = url.indexOf('/', protocolIndex !== -1 ? protocolIndex + 3 : undefined)
|
||||
let indexOfPath = url.indexOf('/', protocolIndex !== -1 ? protocolIndex + 3 : undefined)
|
||||
if (indexOfPath === -1) {
|
||||
indexOfPath = url.indexOf('?', protocolIndex !== -1 ? protocolIndex + 3 : undefined)
|
||||
}
|
||||
if (indexOfPath === -1) {
|
||||
indexOfPath = url.indexOf('#', protocolIndex !== -1 ? protocolIndex + 3 : undefined)
|
||||
}
|
||||
const firstPart = url.substr(0, indexOfPath !== -1 ? indexOfPath : undefined)
|
||||
const path = url.substr(firstPart.length)
|
||||
|
||||
|
Reference in New Issue
Block a user