diff options
author | Johan Preynat <johan.preynat@gmail.com> | 2016-05-04 11:51:39 +0200 |
---|---|---|
committer | Johan Preynat <johan.preynat@gmail.com> | 2016-05-04 11:51:39 +0200 |
commit | bbdf7efc34bfe891b522621b4e3d1d7758b74654 (patch) | |
tree | d7148f2355f805bc2a1ddd7471923a79fcf755b2 /lib/utils/location.js | |
parent | 38a986995a82c6484d677f56ffd68bafcc5398c3 (diff) | |
download | gitbook-bbdf7efc34bfe891b522621b4e3d1d7758b74654.zip gitbook-bbdf7efc34bfe891b522621b4e3d1d7758b74654.tar.gz gitbook-bbdf7efc34bfe891b522621b4e3d1d7758b74654.tar.bz2 |
Fix location.relative(dir, file) trailing slash if file is a directory
Diffstat (limited to 'lib/utils/location.js')
-rw-r--r-- | lib/utils/location.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/utils/location.js b/lib/utils/location.js index 1afe415..b2ac813 100644 --- a/lib/utils/location.js +++ b/lib/utils/location.js @@ -77,7 +77,8 @@ function toAbsolute(_href, dir, outdir) { @return {String} */ function relative(dir, file) { - return normalize(path.relative(dir, file)); + var isDirectory = file.slice(-1) === '/'; + return normalize(path.relative(dir, file)) + (isDirectory? '/': ''); } /** |