diff options
author | David Robillard <d@drobilla.net> | 2020-08-13 01:44:03 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-10-27 13:13:59 +0100 |
commit | b244d0ec5895ff15d52f12704e5f336ad37b4473 (patch) | |
tree | 29bf5c2d05df55ab1fc2ec626988270436e4b6dd /src | |
parent | 8563932ab3abcbf886d1ec77b3ad632aeb9a3ea1 (diff) | |
download | serd-b244d0ec5895ff15d52f12704e5f336ad37b4473.tar.gz serd-b244d0ec5895ff15d52f12704e5f336ad37b4473.tar.bz2 serd-b244d0ec5895ff15d52f12704e5f336ad37b4473.zip |
Refuse to write relative URIRefs to NTriples
Diffstat (limited to 'src')
-rw-r--r-- | src/writer.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/writer.c b/src/writer.c index fe29563b..697d0e7c 100644 --- a/src/writer.c +++ b/src/writer.c @@ -165,6 +165,12 @@ supports_abbrev(const SerdWriter* writer) return writer->syntax == SERD_TURTLE || writer->syntax == SERD_TRIG; } +static bool +supports_uriref(const SerdWriter* writer) +{ + return writer->syntax == SERD_TURTLE || writer->syntax == SERD_TRIG; +} + static SerdStatus free_context(SerdWriter* writer) { @@ -674,6 +680,15 @@ write_uri_node(SerdWriter* const writer, } } + if (!has_scheme && !supports_uriref(writer) && + !serd_env_base_uri(writer->env)) { + SERD_LOG_ERRORF(world, + SERD_ERR_INVALID, + "syntax does not support URI reference <%s>\n", + serd_node_string(node)); + return SERD_ERR_INVALID; + } + TRY(st, esink("<", 1, writer)); if (!(writer->flags & SERD_WRITE_UNRESOLVED) && serd_env_base_uri(writer->env)) { |