aboutsummaryrefslogtreecommitdiffstats
path: root/src/uri.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/uri.c')
-rw-r--r--src/uri.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/uri.c b/src/uri.c
index 8acb79b3..dcdd8083 100644
--- a/src/uri.c
+++ b/src/uri.c
@@ -1,4 +1,4 @@
-// Copyright 2011-2020 David Robillard <d@drobilla.net>
+// Copyright 2011-2023 David Robillard <d@drobilla.net>
// SPDX-License-Identifier: ISC
#include "string_utils.h"
@@ -428,10 +428,6 @@ write_rel_path(SerdSink sink,
len += sink("../", 3, stream);
}
- if (last_shared_sep == 0 && up == 0) {
- len += sink("/", 1, stream);
- }
-
// Write suffix
return len + write_path_tail(sink, stream, uri, last_shared_sep + 1);
}
@@ -468,8 +464,12 @@ serd_uri_serialise_relative(const SerdURI* const uri,
if (uri->authority.buf) {
len += sink("//", 2, stream);
len += sink(uri->authority.buf, uri->authority.len, stream);
- if (uri->authority.len > 0 &&
- uri->authority.buf[uri->authority.len - 1] != '/' &&
+
+ const bool authority_ends_with_slash =
+ (uri->authority.len > 0 &&
+ uri->authority.buf[uri->authority.len - 1] == '/');
+
+ if (!authority_ends_with_slash &&
serd_uri_path_starts_without_slash(uri)) {
// Special case: ensure path begins with a slash
// https://tools.ietf.org/html/rfc3986#section-3.2