Bug 304276

Summary: Spaces converted to + when using web shortcuts
Product: [Plasma] krunner Reporter: Adrián Chaves (Gallaecio) <adrian>
Component: webshortcutsAssignee: Alexander Lohnau <alexander.lohnau>
Status: RESOLVED FIXED    
Severity: wishlist CC: alexander.lohnau, de.meyer.maarten, nate
Priority: NOR    
Version: 4.8.4   
Target Milestone: ---   
Platform: Chakra   
OS: Linux   
Latest Commit: Version Fixed In: 5.72

Description Adrián Chaves (Gallaecio) 2012-07-30 10:30:03 UTC
When using a web shortcut for a wiki, writing “shortcut:Page Title” in Rekonq, for example, will try to open “http://wikiurl.example.com/blahblahblah/Page Title”, and the wiki server will redirect you to “http://wikiurl.example.com/blahblahblah/Page_Title”, the actual page.

But using KRunner, that space is transformed into a +, so Rekonq opens the URL “http://wikiurl.example.com/blahblahblah/Page+Title”, and the wiki server will not redirect you to the actual page.

Reproducible: Always
Comment 1 Maarten De Meyer 2013-04-24 00:12:22 UTC
This is not a problem in krunner but in the shortcut. Rekonq was not using the correct implementation, but in the next version it will also have this problem.

Could you give an real example of a shortcut that has this problem?
Comment 2 Adrián Chaves (Gallaecio) 2013-04-24 05:06:14 UTC
http://en.wikipedia.org/wiki/\{@}

If you call the web shortcut “test”, you can check “test:KDE Plasma Workspaces” both from Rekonq and KRunner. From Rekonq, it opens “http://en.wikipedia.org/wiki/KDE_Plasma_Workspaces”. From KRunner, it opens “http://en.wikipedia.org/wiki/KDE+Plasma+Workspaces” instead.
Comment 3 Maarten De Meyer 2013-04-24 10:23:06 UTC
You are not using the wikipedia search function.
http://en.wikipedia.org/wiki/Special:Search?search=\{@}&go=Go works as it should.

Again I have changed rekonq to use the same implementation as konqueror and krunner. Your test example will no longer work in future versions.
Not converting spaces to + could break a lot of shortcuts.
Comment 4 Adrián Chaves (Gallaecio) 2013-04-24 18:42:56 UTC
Then, let this be a feature request for an alternative key (\{#}?) that does not replace spaces with plus signs.
Comment 5 Adrián Chaves (Gallaecio) 2013-05-02 08:04:27 UTC
Just so this does not sound like a useless request, I though I would explain why Rekonq 2.3.0 has broken my workflow a bit.

I work on MediaWiki sites that, for performance reasons (I guess), do not provide  the Special:Search page. That is, you cannot search those wikis. So, instead, I use the syntax “wiki:Page Name” to open a given page.

This used to work, not from KRunner, but it did from Rekonq directly. Since MediaWiki sites replace spaces with _ automatically, the URL was loaded properly.

Now that spaces are replaced by + signs, and since there are no alternative keywords to \{@} that either do not replace spaces or that transform them into _, I cannot use the same workflow anymore.

Instead, I have to insert the _ symbols instead of spaces myself. This is something trivial, but not much confortable. Just imagine you had to use a + sign instead of a space when searching.

Anyway, I will start using _ instead of whitespaces and try to get used to it.
Comment 6 Maarten De Meyer 2013-05-02 12:21:38 UTC
A small workaround you can use:
http://en.wikipedia.org/wiki/\{1} \{2} \{3} \{4} \{5}

And so on for the maximum amount of arguments you will ever need.
I know, it is not a clean solution. But it works :)
Comment 7 Bug Janitor Service 2020-06-24 16:48:21 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/65
Comment 8 Alexander Lohnau 2020-06-26 03:39:40 UTC
Git commit 759624d03bf7a0358ba07422655cb3ab873d7e4c by Alexander Lohnau.
Committed on 26/06/2020 at 03:39.
Pushed by alex into branch 'master'.

Also encode space characters for webshortcut URLs
Related: bug 423255
FIXED-IN: 5.72

M  +1    -1    autotests/kurifiltertest.cpp
M  +2    -3    src/urifilters/ikws/kuriikwsfiltereng.cpp

https://invent.kde.org/frameworks/kio/commit/759624d03bf7a0358ba07422655cb3ab873d7e4c