File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,8 @@ import { escapeRegex } from './Util';
33// Do not handle base IRIs without scheme, and currently unsupported cases:
44// - file: IRIs (which could also use backslashes)
55// - IRIs containing /. or /.. or //
6- const INVALID_OR_UNSUPPORTED = / ^ : ? [ ^ : ? # ] * (?: [ ? # ] | $ ) | ^ f i l e : | ^ [ ^ : ] * : \/ * [ ^ ? # ] + ?\/ (?: \. \. ? (?: \/ | $ ) | \/ ) / i;
6+ const BASE_UNSUPPORTED = / ^ : ? [ ^ : ? # ] * (?: [ ? # ] | $ ) | ^ f i l e : | ^ [ ^ : ] * : \/ * [ ^ ? # ] + ?\/ (?: \. \. ? (?: \/ | $ ) | \/ ) / i;
7+ const SUFFIX_SUPPORTED = / ^ (?: (?: [ ^ / ? # ] { 3 , } | \. ? [ ^ / ? # . ] \. ? ) (?: \/ [ ^ / ? # ] { 3 , } | \. ? [ ^ / ? # . ] \. ? ) * \/ ? ) ? (?: [ ? # ] | $ ) / ;
78const CURRENT = './' ;
89const PARENT = '../' ;
910const QUERY = '?' ;
@@ -18,7 +19,7 @@ export default class BaseIRI {
1819 }
1920
2021 static supports ( base ) {
21- return ! INVALID_OR_UNSUPPORTED . test ( base ) ;
22+ return ! BASE_UNSUPPORTED . test ( base ) ;
2223 }
2324
2425 _getBaseMatcher ( ) {
@@ -85,9 +86,7 @@ export default class BaseIRI {
8586 if ( parentPath ) {
8687 const suffix = iri . substring ( length ) ;
8788 // Don't abbreviate unsupported path
88- if ( parentPath !== QUERY &&
89- / (?: ^ | \/ ) (?: \/ | ..? (?: [ / # ? ] | $ ) ) / . test ( suffix ) && // fast test
90- / ^ (?: [ ^ # ? ] * ?\/ ) ? (?: \/ | \. \. ? (?: [ / # ? ] | $ ) ) / . test ( suffix ) ) // rigorous test
89+ if ( parentPath !== QUERY && ! SUFFIX_SUPPORTED . test ( suffix ) )
9190 return iri ;
9291 // Omit ./ with fragment or query string
9392 if ( parentPath === CURRENT && / ^ [ ^ ? # ] / . test ( suffix ) )
You can’t perform that action at this time.
0 commit comments