1
0
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:
2020-10-20 15:39:48 +02:00
parent 5c230d74e5
commit db2474b594
4 changed files with 43 additions and 5 deletions

View File

@ -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)