Make the bookmarklet compatible with ugly URLs

This commit is contained in:
Pierre Rudloff 2020-10-22 01:36:00 +02:00
parent d97b824a44
commit e1d7ad44e0
2 changed files with 2 additions and 2 deletions

View file

@ -83,7 +83,7 @@ class ViewFactory
$view->offsetSet('canonical', self::getCanonicalUrl($request)); $view->offsetSet('canonical', self::getCanonicalUrl($request));
$view->offsetSet('locale', $container->get('locale')->getLocale()); $view->offsetSet('locale', $container->get('locale')->getLocale());
$view->offsetSet('config', $container->get('config')); $view->offsetSet('config', $container->get('config'));
$view->offsetSet('domain', $uri->withPath('')->withBasePath('')); $view->offsetSet('domain', rtrim($uri->withPath('')->withBasePath(''), '/'));
return $view; return $view;
} }

View file

@ -42,7 +42,7 @@
<div id="bookmarklet" class="bookmarklet_wrapper"> <div id="bookmarklet" class="bookmarklet_wrapper">
<p> {t}Drag this to your bookmarks bar:{/t} </p> <p> {t}Drag this to your bookmarks bar:{/t} </p>
<a class="bookmarklet small-font" <a class="bookmarklet small-font"
href="javascript:window.location='{$domain}{path_for name='info'}?url='+encodeURIComponent(location.href);">{t}Bookmarklet{/t}</a> href="javascript:window.location='{$domain}{path_for name='info' queryParams=['url' => '%url%']}'.replace('%url%', encodeURIComponent(location.href));">{t}Bookmarklet{/t}</a>
</div> </div>
</main> </main>