From 79ae4dd511f0e38d052684044ab97fdf62dd3d95 Mon Sep 17 00:00:00 2001 From: Ben Wheeler Date: Tue, 20 Nov 2018 15:03:57 -0500 Subject: [PATCH] let pathname end without a slash --- src/views/preview/preview.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/views/preview/preview.jsx b/src/views/preview/preview.jsx index 613fbfea3..9216ea607 100644 --- a/src/views/preview/preview.jsx +++ b/src/views/preview/preview.jsx @@ -743,13 +743,17 @@ const ConnectedPreview = connect( // replace old Scratch 2.0-style hashtag URLs with updated format if (window.location.hash) { + let pathname = window.location.pathname; + if (pathname.substr(-1) !== '/') { + pathname = `${pathname}/`; + } if (window.location.hash === '#editor') { history.replaceState({}, document.title, - `${window.location.origin}${window.location.pathname}editor${window.location.search}`); + `${pathname}editor${window.location.search}`); } if (window.location.hash === '#fullscreen') { history.replaceState({}, document.title, - `${window.location.origin}${window.location.pathname}fullscreen${window.location.search}`); + `${pathname}fullscreen${window.location.search}`); } }