From 9269849da29b56dc74111ea91f40e842a32bb244 Mon Sep 17 00:00:00 2001 From: sinkuu Date: Mon, 11 Jul 2016 23:38:18 +0900 Subject: [PATCH] Leave trailing slash when going up path (#781) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Previously: - `/some/path` → `/some` - `/some/path/` → `/some` Now: - `/some/path` → `/some/` - `/some/path/` → `/some/` The convention on most modern sites seem to be to make a trailing slash optional. But especially on older servers, no trailing slash means "view file", while a trailing slash means "view directory". Removing the trailing slash in such cases most likely results in a 404, while preserving it gives a useful result. --- extension/lib/commands-frame.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extension/lib/commands-frame.coffee b/extension/lib/commands-frame.coffee index 2966810..54ef2d0 100644 --- a/extension/lib/commands-frame.coffee +++ b/extension/lib/commands-frame.coffee @@ -58,8 +58,8 @@ FOLLOW_SELECTABLE_SELECTORS = commands = {} commands.go_up_path = ({vim, count = 1}) -> - {pathname} = vim.content.location - newPathname = pathname.replace(/// (?: /[^/]+ ){1,#{count}} /?$ ///, '') + {pathname} = vim.content.location + newPathname = pathname.replace(/// (?: [^/]+(/|$) ){1,#{count}} $ ///, '') if newPathname == pathname vim.notify(translate('notification.go_up_path.limit')) else -- 2.39.3