From b04f314afa2cf069b29187f17667465a2d0890c3 Mon Sep 17 00:00:00 2001 From: Dave Longley Date: Fri, 21 Feb 2014 12:18:18 -0500 Subject: [PATCH] Always remove last base segment when calculating relative urls. --- jsonld.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/jsonld.php b/jsonld.php index 25da6b9..c559e68 100644 --- a/jsonld.php +++ b/jsonld.php @@ -1,7 +1,7 @@ 0) { - // don't count the last segment if it isn't a path (doesn't end in '/') - // don't count empty first segment, it means base began with '/' - if(substr($base['normalizedPath'], -1) !== '/' || - $base_segments[0] === '') { - array_pop($base_segments); - } + // don't count the last segment (if it ends with '/' last path doesn't + // count and if it doesn't end with '/' it isn't a path) + array_pop($base_segments); foreach($base_segments as $segment) { $rval .= '../'; }