Skip to content

Commit 804c15b

Browse files
committed
Do minimal checking to see if IRIs are valid by making sure they contain no whitespace.
1 parent 5800546 commit 804c15b

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

‎CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
### Fixed
1010
- JSON literal value handling issues.
11+
- Do minimal checking to see if IRIs are valid by making sure they contain
12+
no whitespace.
1113

1214
## 2.0.0 - 2019-12-09
1315

‎lib/url.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ api.removeDotSegments = path => {
277277
// http://jmrware.com/articles/2009/uri_regexp/URI_regex.html
278278

279279
// regex to check for absolute IRI (starting scheme and ':') or blank node IRI
280-
const isAbsoluteRegex = /^([A-Za-z][A-Za-z0-9+-.]*|_):/;
280+
const isAbsoluteRegex = /^([A-Za-z][A-Za-z0-9+-.]*|_):[^\s]*$/;
281281

282282
/**
283283
* Returns true if the given value is an absolute IRI or blank node IRI, false

‎tests/test-common.js

-4
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ const TEST_TYPES = {
7272
/expand-manifest.jsonld#t0119$/,
7373
/expand-manifest.jsonld#t0120$/,
7474
/expand-manifest.jsonld#t0122$/,
75-
// invalid datatype IRI
76-
/expand-manifest.jsonld#t0123$/,
7775
// html
7876
/html-manifest.jsonld#te001$/,
7977
/html-manifest.jsonld#te002$/,
@@ -331,8 +329,6 @@ const TEST_TYPES = {
331329
/toRdf-manifest.jsonld#te119$/,
332330
/toRdf-manifest.jsonld#te120$/,
333331
/toRdf-manifest.jsonld#te122$/,
334-
// invalid datatype IRI
335-
/toRdf-manifest.jsonld#te123$/,
336332
// well formed
337333
/toRdf-manifest.jsonld#twf01$/,
338334
/toRdf-manifest.jsonld#twf02$/,

0 commit comments

Comments
 (0)