Version: (using KDE KDE 3.1) Installed from: Mandrake RPMs OS: Linux When actions are enabled and a URL is highlighted (put into the clipboard), and "Open with Mozilla" is selected, Mozilla gets an error "URL is invalid and cannot be loaded" as it tries to open the URL, and the URL shows up in the location bar as having single quotes. This bug is mentioned on the freebsd/kde bug site (http://freebsd.kde.org/bugs.shtml) but I found no mention of it anywhere else.
Sorry, I must have selected the wrong option for "Installed from." I installed via the Redhat 7.3 RPM's at kde-redhat.sourceforge.net
Please give a url that exhibits this behaviour. i cannot reproduce it on Linux with KDE-3.1-BRANCH (CVS)
I exhibit this behavior on all URLs, when attempting to open in mozilla. Mozilla version is 1.0.1, Klipper version is 0.9.5
Mozilla 1.2.1, freebsd -stable, klipper 0.9.5/kde 3.1.0 The problem exists here too, all URLs. However, I found no such quoting problems when I changed the action to, /home/jan/bin/startmoz "%s" Which is the following script: [[ #!/bin/sh PATH=/usr/bin:/bin:/usr/local/bin:/usr/X11R6/bin export PATH echo "My parameters are: $*" >> /home/jan/tmp/startmoz.log (ps x |grep -q '[m]ozilla' && mozilla -remote "openURL($1, new-window)" || \ mozilla "$1") 1>>/home/cmjg/tmp/startmoz.log 2> &1 & ]]
I was able to get around this by changing: ps x |grep -q '[m]ozilla' && mozilla -remote "openURL(%s, new-window)" || mozilla %s to ps x |grep -q '[m]ozilla' && mozilla -remote "openURL(`echo %s`, new-window)" || mozilla %s apparently klipper surrounds the clipboard contents with ' and mozilla's openURL can't handle it anymore. Jer
Created attachment 1375 [details] Fix mozilla remote action.
I just ran into this same bug and spent some time fixing it. I see the status of this bug is still 'UNCONFIRMED' so I will supply some version information regarding my own setup that reproduced this: System : Debian Sid Debian Klipper Version : 4:3.1.1-1 Debian mozilla-browser Version : 2:1.3-4 (Mozilla 1.3) Steps to reproduce : 1) Shut down all instances of Mozilla 2) select text http://www.google.com 3) Select 'Open with Mozilla' from klipper popup window 4) observe Mozilla opens to http://www.google.com 4a) - leave mozilla running - 5) select text http://rws.dnsalias.net 6) select 'Open with Mozilla' from klipper popup window 7) witness Mozilla window 'The URL is not valid and cannot be loaded.' 8) click 'Ok' 9) witness new mozilla window with the text 'http://rws.dnsalias.net' (including single quote characters) in location bar I have attached a patch which I belive will fix this problem. Perhaps mozilla should accept URLs surrounded by single quote characters. I also think however that this should be fixed in klipper, if only because it is more correct.
BTW, the above patch is against KDE_3_1_BRANCH, file obtained from : http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdebase/klipper/klipperrc.desktop?rev=1.81.2.3&content-type=text/x-cvsweb-markup
I have this problem with all URLs, using Mozilla 1.3 and Klipper 0.95. Mozilla gives the mentioned error message, but in my case the new tab is just empty and has 'about:blank' in the address bar. Jeremy's workaround (comment #5) worked for me.
This has nothing to do with Mozilla. Klipper inserts single quotes in the command line when the %s is in double quotes, except in the case of "%s". To see this create a command called barf #! /bin/bash date > /tmp/barf echo $1 >> /tmp/barf then set up an action with a command of barf "hello%s" select some text, run the action, cat /tmp/barf to get hello'selected text' So the bug is that klipper sometimes puts in single quotes when you don't ask for them and there's no way to turn it off. It just happens that the action for Mozilla brings out this bug.
ok, there are two bugs. I'll fix the one outlined in comment #10, but the other one is a mozilla bug and KDE != mozilla.
Just in case anyone is worried, there is no Mozilla bug, (actually, there are lots but they aren't related to this problem).
Subject: kdebase/klipper CVS commit by mueller: do proper shell escaping CCMAIL: 53886-done@bugs.kde.org M +5 -25 urlgrabber.cpp 1.38 --- kdebase/klipper/urlgrabber.cpp #1.37:1.38 @@ -25,4 +25,5 @@ #include <netwm.h> #include <kstringhandler.h> +#include <kmacroexpander.h> #include "urlgrabber.h" @@ -225,29 +226,8 @@ void URLGrabber::execute( const struct C { if ( command->isEnabled ) { - QString cmdLine = command->command; - QString escClipData = KProcess::quote(myClipData); - - // replace "%s", '%s' and %s with the clipboard contents - // the quotes have to be replaced as well as they might - // be part of config files from older klipper versions - // replace \%s to %s - int pos = 0; - while ( (pos = cmdLine.find("%s", pos)) >= 0 ) { - if ( pos > 0 && cmdLine.at( pos - 1 ) == '\\' ) { - cmdLine.remove( pos -1, 1 ); // \%s -> %s - pos++; - } - else if (pos > 0 && (cmdLine[pos - 1] == '\'' || cmdLine[pos - 1] == '"') && - pos + 2 < cmdLine.length() && cmdLine[pos + 2] == cmdLine[pos - 1]) { - cmdLine.replace ( pos - 1, 4, escClipData ); - pos += escClipData.length(); - } - else { - cmdLine.replace( pos, 2, escClipData ); - pos += escClipData.length(); - } - } + QMap<QChar,QString> map; + map.insert( 's', myClipData ); + QString cmdLine = KMacroExpander::expandMacrosShellQuote( command->command, map ); - kdDebug() << "now starting " << cmdLine << endl; if ( cmdLine.isEmpty() ) return;