diff --git a/packages/apidom-reference/src/util/url.ts b/packages/apidom-reference/src/util/url.ts index f8f4e1387f..96ec6558e8 100644 --- a/packages/apidom-reference/src/util/url.ts +++ b/packages/apidom-reference/src/util/url.ts @@ -250,16 +250,12 @@ export const sanitize = (uri: string) => { return fromFileSystemPath(toFileSystemPath(uri)); } - let returnUri; - try { - returnUri = new URL(uri).toString(); - } catch (e) { + return new URL(uri).toString(); + } catch { // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURI#encoding_for_ipv6 - returnUri = encodeURI(decodeURI(uri)).replace(/%5B/g, '[').replace(/%5D/g, ']'); + return encodeURI(decodeURI(uri)).replace(/%5B/g, '[').replace(/%5D/g, ']'); } - - return returnUri; }; /**