File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -824,6 +824,17 @@ api.compactIri = ({
824
824
return choice ;
825
825
}
826
826
827
+ // If iri could be confused with a compact IRI using a term in this context,
828
+ // signal an error
829
+ for ( const [ term , td ] of activeCtx . mappings ) {
830
+ if ( iri . startsWith ( term + ':' ) && td . _prefix ) {
831
+ throw new JsonLdError (
832
+ ( 'Absolute IRI "' + iri + '" confused with prefix "' + term + '"' ) ,
833
+ 'jsonld.SyntaxError' ,
834
+ { code : 'IRI confused with prefix' , context : activeCtx } ) ;
835
+ }
836
+ }
837
+
827
838
// compact IRI relative to base
828
839
if ( ! relativeTo . vocab ) {
829
840
return _removeBase ( activeCtx [ '@base' ] , iri ) ;
Original file line number Diff line number Diff line change @@ -48,8 +48,6 @@ const TEST_TYPES = {
48
48
/ c o m p a c t - m a n i f e s t .j s o n l d # t p i 0 4 $ / ,
49
49
/ c o m p a c t - m a n i f e s t .j s o n l d # t p i 0 5 $ / ,
50
50
/ c o m p a c t - m a n i f e s t .j s o n l d # t p i 0 6 $ / ,
51
- // IRI confusion
52
- / c o m p a c t - m a n i f e s t .j s o n l d # t e 0 0 2 $ / ,
53
51
// @propogate
54
52
/ c o m p a c t - m a n i f e s t .j s o n l d # t c 0 2 6 $ / ,
55
53
/ c o m p a c t - m a n i f e s t .j s o n l d # t c 0 2 7 $ / ,
You can’t perform that action at this time.
0 commit comments