Bug 82325

Summary: linefeeds with following space are not removed from mmb-pasted urls
Product: [Applications] konqueror Reporter: Leo Savernik <l.savernik>
Component: khtmlAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Leo Savernik 2004-05-27 19:45:55 UTC
Version:            (using KDE KDE 3.2.2)
Installed from:    Compiled From Sources

In web fora or e-mails of certain MUAs, long urls are often broken across multiple lines.

When mmb-pasting, these URLs contain %0As. Those are removed iff no space follows the linebreak.

However, a khtml selected url will almost always contain linebreaks which have a following space.

F. i.:
http://.../very/lo
ng/url

selected from KHTML will be pasted as

http://.../very/lo%0A ng/url

on mmb. Note the space that is following the line break.

I propose that any space following a linebreak is removed.
Comment 1 Leo Savernik 2004-05-27 23:48:35 UTC
This isn't a wishlist item. The original feature (remove linefeeds from pasted urls) already works. This report is about a special circumstance in which linefeed removal fails.

Maybe the wording in the summary is misleading. I'll change it to reflect the bug-like nature of this report.
Comment 2 Waldo Bastian 2004-06-01 18:41:51 UTC
CVS commit by waba: 

Remove linefeeds and any whitespace surrounding it from pasted URLs (BR82325)
CCMAIL: 82325-done@bugs.kde.org


  M +3 -0      browserextension.cpp   1.63


--- kdelibs/kparts/browserextension.cpp  #1.62:1.63
@@ -25,4 +25,5 @@
 #include <qobjectlist.h>
 #include <qmetaobject.h>
+#include <qregexp.h>
 #include <qstrlist.h>
 #include <qstylesheet.h>
@@ -430,4 +431,6 @@ void BrowserExtension::pasteRequest()
     QCString plain("plain");
     QString url = QApplication::clipboard()->text(plain, QClipboard::Selection).stripWhiteSpace();
+    // Remove linefeeds and any whitespace surrounding it.
+    url.replace(QRegExp("[\\ ]*\\n+[\\ ]*"),"");
 
     // Check if it's a URL