From 5487563a710d1219565012dd3ab8da82414d47ce Mon Sep 17 00:00:00 2001 From: Bart Kamphorst Date: Mon, 7 Oct 2019 11:22:00 +0200 Subject: [PATCH] Make regex more lenient. Nest redirect logic. --- lib/gollum/public/gollum/javascript/gollum.js.erb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/gollum/public/gollum/javascript/gollum.js.erb b/lib/gollum/public/gollum/javascript/gollum.js.erb index 1e27a0d9..3a99f7ec 100755 --- a/lib/gollum/public/gollum/javascript/gollum.js.erb +++ b/lib/gollum/public/gollum/javascript/gollum.js.erb @@ -154,10 +154,6 @@ $(document).ready(function() { } } - if (match = new RegExp(/\?redirected\_from=([^?]*)/).exec(window.location.href)) { - notice = "The page you requested was renamed or moved. You've been successfully redirected to its new location."; - flashNotice('success', notice); - } if ($('#minibutton-upload-page').length) { new ClipboardJS('#ClipboardJSlink'); @@ -611,7 +607,11 @@ $(document).ready(function() { if($('.markdown-body').length ){ // Set text direction (LTR or RTL) preparePage(); - + // Check if there was a redirect here + if (match = new RegExp(/[?&]redirected\_from=([^?]*)/).exec(window.location.href)) { + notice = "The page you requested was renamed or moved. You've been successfully redirected to its new location."; + flashNotice('success', notice); + } // Set the 'e' hotkey for editing pages. Mousetrap.bind(['e'], function( e ) { e.preventDefault();