From f00327a70dd37ea3dc8b3a2eb790441007b9d9c8 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sun, 4 Oct 2015 15:40:29 -0700 Subject: [PATCH] Normalize URL feature should remove excess slashes. #499 --- src/General/Main.coffee | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/General/Main.coffee b/src/General/Main.coffee index d73262b81..36e2fa2f1 100755 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -133,11 +133,17 @@ Main = ImageCommon.addControls video return - if Conf['Normalize URL'] and g.VIEW is 'thread' + if Conf['Normalize URL'] pathname = location.pathname.split /\/+/ - if pathname[2] isnt 'thread' or pathname.length > 4 - pathname[2] = 'thread' - history.replaceState null, '', "#{location.protocol}//#{location.host}#{pathname[0...4].join('/')}#{location.hash}" + switch g.VIEW + when 'thread' + pathname[2] = 'thread' + pathname = pathname[0...4] + when 'index' + pathname = pathname[0...3] + pathname = pathname.join '/' + if location.pathname isnt pathname + history.replaceState history.state, '', "#{location.protocol}//#{location.host}#{pathname}#{location.hash}" # c.time 'All initializations' for [name, feature] in Main.features