Bug 85693

Summary: String.link() function does not correctly quote the url.
Product: [Applications] konqueror Reporter: Brian Glass <bjg>
Component: kjsAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Mandrake RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Brian Glass 2004-07-22 14:37:55 UTC
Version:           3.2.0 (using KDE KDE 3.2.1)
Installed from:    Mandrake RPMs
OS:                Linux

The following code exercises this bug. This code works in all other browsers I've tried.  My assumption is that when the link() function is called it does not correctly quote the url. This function seems to work OK if there are no spaces in the URL - which is why I assume the quoting problem.

In the test code, clicking on the link should change the text in the input box but it does not.

<html>
    <head>
        <title>Test</title>
        <script type="text/javascript">
            function foo( a, b, c )
            {
                document.getElementById("baz").value = a + b + c;
            }
        </script>
    </head>
    <body>
        <script type="text/javascript">
            var foobar = "This is a test.";
            document.write( foobar.link( "javascript:foo( 'This ', 'is ', 'a test' )" ) );
        </script>

        <input id="baz" value="This should change." />
    </body>
</html>
Comment 1 Pascal Létourneau 2004-09-30 21:58:07 UTC
CVS commit by pletourn: 

Missing quotation in attributes
CCMAIL:85693-done@bugs.kde.org


  M +4 -4      string_object.cpp   1.85.4.1


--- kdelibs/kjs/string_object.cpp  #1.85:1.85.4.1
@@ -543,17 +543,17 @@ Value StringProtoFuncImp::call(ExecState
     break;
   case Fontcolor:
-    result = String("<FONT COLOR=" + a0.toString(exec) + ">"
+    result = String("<FONT COLOR=\"" + a0.toString(exec) + "\">"
                     + s + "</FONT>");
     break;
   case Fontsize:
-    result = String("<FONT SIZE=" + a0.toString(exec) + ">"
+    result = String("<FONT SIZE=\"" + a0.toString(exec) + "\">"
                     + s + "</FONT>");
     break;
   case Anchor:
-    result = String("<a name=" + a0.toString(exec) + ">"
+    result = String("<a name=\"" + a0.toString(exec) + "\">"
                     + s + "</a>");
     break;
   case Link:
-    result = String("<a href=" + a0.toString(exec) + ">"
+    result = String("<a href=\"" + a0.toString(exec) + "\">"
                     + s + "</a>");
     break;