You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@shindig.apache.org by "Xipan Xiao (JIRA)" <ji...@apache.org> on 2012/04/26 23:04:50 UTC

[jira] [Created] (SHINDIG-1761) IE: fail to process file upload response with special characters (")

Xipan Xiao created SHINDIG-1761:
-----------------------------------

             Summary: IE: fail to process file upload response with special characters (&quot;)
                 Key: SHINDIG-1761
                 URL: https://issues.apache.org/jira/browse/SHINDIG-1761
             Project: Shindig
          Issue Type: Bug
          Components: Java
    Affects Versions: 2.0.2
         Environment: IE
            Reporter: Xipan Xiao


The server responds the following HTML content when uploading a file. Inside the <textarea> element, there is a JSON object. It is a valid JSON string, however, when this arrives the client side in an iframe, the JSON string extracted from the <textarea> element is decoded, thus all (&quot;) are converted to (") and that breaks the string. See the following code:

var txt = iframe.document.getElementsByTagName("textarea")[0].value;//this txt is an invalid JSON string.

For browsers like Firefox that has the window.FormData object, we're using AJAX to upload files and sever reponses are processed directly, without putting into an iframe/textarea element. For IE we can't avoid putting the response into an iframe.

The HTML response that causes the problem:

<html><head></head><body><textarea>{"http://example.com/upload":{"rc":200,"body":"{&quot;errorCode&quot;:&quot;InvalidRequest&quot;,&quot;errorMessage&quot;:&quot;An error occurred while handling reading the API request.  The request cannot be completed.&quot;}"}}</textarea></body></html>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SHINDIG-1761) IE: fail to process file upload response with special characters (")

Posted by "jiraposter@reviews.apache.org (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1761?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13263769#comment-13263769 ] 

jiraposter@reviews.apache.org commented on SHINDIG-1761:
--------------------------------------------------------


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/4896/
-----------------------------------------------------------

(Updated 2012-04-27 16:24:50.944369)


Review request for shindig.


Changes
-------

Removed unused import and added a test for the escaping stuff.


Summary
-------

Ran into an issue where the server response was being partially un-escaped by the browser if it had escaped html entities in it.


This addresses bug SHINDIG-1761.
    https://issues.apache.org/jira/browse/SHINDIG-1761


Diffs (updated)
-----

  http://svn.apache.org/repos/asf/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/MakeRequestHandler.java 1329959 
  http://svn.apache.org/repos/asf/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/servlet/MakeRequestHandlerTest.java 1329959 

Diff: https://reviews.apache.org/r/4896/diff


Testing
-------

Tests still pass :)


Thanks,

Dan


                
> IE: fail to process file upload response with special characters (&quot;)
> -------------------------------------------------------------------------
>
>                 Key: SHINDIG-1761
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1761
>             Project: Shindig
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: 2.0.2
>         Environment: IE
>            Reporter: Xipan Xiao
>            Assignee: Dan Dumont
>
> The server responds the following HTML content when uploading a file. Inside the <textarea> element, there is a JSON object. It is a valid JSON string, however, when this arrives the client side in an iframe, the JSON string extracted from the <textarea> element is decoded, thus all (&quot;) are converted to (") and that breaks the string. See the following code:
> var txt = iframe.document.getElementsByTagName("textarea")[0].value;//this txt is an invalid JSON string.
> For browsers like Firefox that has the window.FormData object, we're using AJAX to upload files and sever reponses are processed directly, without putting into an iframe/textarea element. For IE we can't avoid putting the response into an iframe.
> The HTML response that causes the problem:
> <html><head></head><body><textarea>{"http://example.com/upload":{"rc":200,"body":"{&quot;errorCode&quot;:&quot;InvalidRequest&quot;,&quot;errorMessage&quot;:&quot;An error occurred while handling reading the API request.  The request cannot be completed.&quot;}"}}</textarea></body></html>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SHINDIG-1761) IE: fail to process file upload response with special characters (")

Posted by "jiraposter@reviews.apache.org (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1761?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13263642#comment-13263642 ] 

jiraposter@reviews.apache.org commented on SHINDIG-1761:
--------------------------------------------------------


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/4896/
-----------------------------------------------------------

(Updated 2012-04-27 13:24:54.504330)


Review request for shindig.


Changes
-------

Adding JIRA


Summary
-------

Ran into an issue where the server response was being partially un-escaped by the browser if it had escaped html entities in it.


This addresses bug SHINDIG-1761.
    https://issues.apache.org/jira/browse/SHINDIG-1761


Diffs
-----

  http://svn.apache.org/repos/asf/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/MakeRequestHandler.java 1329959 

Diff: https://reviews.apache.org/r/4896/diff


Testing
-------

Tests still pass :)


Thanks,

Dan


                
> IE: fail to process file upload response with special characters (&quot;)
> -------------------------------------------------------------------------
>
>                 Key: SHINDIG-1761
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1761
>             Project: Shindig
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: 2.0.2
>         Environment: IE
>            Reporter: Xipan Xiao
>
> The server responds the following HTML content when uploading a file. Inside the <textarea> element, there is a JSON object. It is a valid JSON string, however, when this arrives the client side in an iframe, the JSON string extracted from the <textarea> element is decoded, thus all (&quot;) are converted to (") and that breaks the string. See the following code:
> var txt = iframe.document.getElementsByTagName("textarea")[0].value;//this txt is an invalid JSON string.
> For browsers like Firefox that has the window.FormData object, we're using AJAX to upload files and sever reponses are processed directly, without putting into an iframe/textarea element. For IE we can't avoid putting the response into an iframe.
> The HTML response that causes the problem:
> <html><head></head><body><textarea>{"http://example.com/upload":{"rc":200,"body":"{&quot;errorCode&quot;:&quot;InvalidRequest&quot;,&quot;errorMessage&quot;:&quot;An error occurred while handling reading the API request.  The request cannot be completed.&quot;}"}}</textarea></body></html>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SHINDIG-1761) IE: fail to process file upload response with special characters (")

Posted by "jiraposter@reviews.apache.org (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1761?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13263816#comment-13263816 ] 

jiraposter@reviews.apache.org commented on SHINDIG-1761:
--------------------------------------------------------


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/4896/#review7310
-----------------------------------------------------------

Ship it!


LGTM

- Ryan


On 2012-04-27 16:24:50, Dan Dumont wrote:
bq.  
bq.  -----------------------------------------------------------
bq.  This is an automatically generated e-mail. To reply, visit:
bq.  https://reviews.apache.org/r/4896/
bq.  -----------------------------------------------------------
bq.  
bq.  (Updated 2012-04-27 16:24:50)
bq.  
bq.  
bq.  Review request for shindig.
bq.  
bq.  
bq.  Summary
bq.  -------
bq.  
bq.  Ran into an issue where the server response was being partially un-escaped by the browser if it had escaped html entities in it.
bq.  
bq.  
bq.  This addresses bug SHINDIG-1761.
bq.      https://issues.apache.org/jira/browse/SHINDIG-1761
bq.  
bq.  
bq.  Diffs
bq.  -----
bq.  
bq.    http://svn.apache.org/repos/asf/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/MakeRequestHandler.java 1329959 
bq.    http://svn.apache.org/repos/asf/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/servlet/MakeRequestHandlerTest.java 1329959 
bq.  
bq.  Diff: https://reviews.apache.org/r/4896/diff
bq.  
bq.  
bq.  Testing
bq.  -------
bq.  
bq.  Tests still pass :)
bq.  
bq.  
bq.  Thanks,
bq.  
bq.  Dan
bq.  
bq.


                
> IE: fail to process file upload response with special characters (&quot;)
> -------------------------------------------------------------------------
>
>                 Key: SHINDIG-1761
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1761
>             Project: Shindig
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: 2.0.2
>         Environment: IE
>            Reporter: Xipan Xiao
>            Assignee: Dan Dumont
>
> The server responds the following HTML content when uploading a file. Inside the <textarea> element, there is a JSON object. It is a valid JSON string, however, when this arrives the client side in an iframe, the JSON string extracted from the <textarea> element is decoded, thus all (&quot;) are converted to (") and that breaks the string. See the following code:
> var txt = iframe.document.getElementsByTagName("textarea")[0].value;//this txt is an invalid JSON string.
> For browsers like Firefox that has the window.FormData object, we're using AJAX to upload files and sever reponses are processed directly, without putting into an iframe/textarea element. For IE we can't avoid putting the response into an iframe.
> The HTML response that causes the problem:
> <html><head></head><body><textarea>{"http://example.com/upload":{"rc":200,"body":"{&quot;errorCode&quot;:&quot;InvalidRequest&quot;,&quot;errorMessage&quot;:&quot;An error occurred while handling reading the API request.  The request cannot be completed.&quot;}"}}</textarea></body></html>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (SHINDIG-1761) IE: fail to process file upload response with special characters (")

Posted by "Dan Dumont (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SHINDIG-1761?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dan Dumont reassigned SHINDIG-1761:
-----------------------------------

    Assignee: Dan Dumont
    
> IE: fail to process file upload response with special characters (&quot;)
> -------------------------------------------------------------------------
>
>                 Key: SHINDIG-1761
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1761
>             Project: Shindig
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: 2.0.2
>         Environment: IE
>            Reporter: Xipan Xiao
>            Assignee: Dan Dumont
>
> The server responds the following HTML content when uploading a file. Inside the <textarea> element, there is a JSON object. It is a valid JSON string, however, when this arrives the client side in an iframe, the JSON string extracted from the <textarea> element is decoded, thus all (&quot;) are converted to (") and that breaks the string. See the following code:
> var txt = iframe.document.getElementsByTagName("textarea")[0].value;//this txt is an invalid JSON string.
> For browsers like Firefox that has the window.FormData object, we're using AJAX to upload files and sever reponses are processed directly, without putting into an iframe/textarea element. For IE we can't avoid putting the response into an iframe.
> The HTML response that causes the problem:
> <html><head></head><body><textarea>{"http://example.com/upload":{"rc":200,"body":"{&quot;errorCode&quot;:&quot;InvalidRequest&quot;,&quot;errorMessage&quot;:&quot;An error occurred while handling reading the API request.  The request cannot be completed.&quot;}"}}</textarea></body></html>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (SHINDIG-1761) IE: fail to process file upload response with special characters (")

Posted by "Dan Dumont (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SHINDIG-1761?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dan Dumont resolved SHINDIG-1761.
---------------------------------

    Resolution: Fixed

Committed r1351048
                
> IE: fail to process file upload response with special characters (&quot;)
> -------------------------------------------------------------------------
>
>                 Key: SHINDIG-1761
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1761
>             Project: Shindig
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: 2.0.2
>         Environment: IE
>            Reporter: Xipan Xiao
>            Assignee: Dan Dumont
>
> The server responds the following HTML content when uploading a file. Inside the <textarea> element, there is a JSON object. It is a valid JSON string, however, when this arrives the client side in an iframe, the JSON string extracted from the <textarea> element is decoded, thus all (&quot;) are converted to (") and that breaks the string. See the following code:
> var txt = iframe.document.getElementsByTagName("textarea")[0].value;//this txt is an invalid JSON string.
> For browsers like Firefox that has the window.FormData object, we're using AJAX to upload files and sever reponses are processed directly, without putting into an iframe/textarea element. For IE we can't avoid putting the response into an iframe.
> The HTML response that causes the problem:
> <html><head></head><body><textarea>{"http://example.com/upload":{"rc":200,"body":"{&quot;errorCode&quot;:&quot;InvalidRequest&quot;,&quot;errorMessage&quot;:&quot;An error occurred while handling reading the API request.  The request cannot be completed.&quot;}"}}</textarea></body></html>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SHINDIG-1761) IE: fail to process file upload response with special characters (")

Posted by "jiraposter@reviews.apache.org (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1761?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13263652#comment-13263652 ] 

jiraposter@reviews.apache.org commented on SHINDIG-1761:
--------------------------------------------------------



bq.  On 2012-04-26 21:15:47, Ryan Baxter wrote:
bq.  > LGTM.  Since our existing test cases didn't catch this can we add a test case for this?
bq.  
bq.  Dan Dumont wrote:
bq.      A jsunit test case wouldn't have caught this I don't think...   It would require a functional dom and iframe component to see the issue.

But you could write a junit test and verify we escape it properly so when it does get returned to the browser we don't run into the problem.


- Ryan


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/4896/#review7281
-----------------------------------------------------------


On 2012-04-27 13:24:54, Dan Dumont wrote:
bq.  
bq.  -----------------------------------------------------------
bq.  This is an automatically generated e-mail. To reply, visit:
bq.  https://reviews.apache.org/r/4896/
bq.  -----------------------------------------------------------
bq.  
bq.  (Updated 2012-04-27 13:24:54)
bq.  
bq.  
bq.  Review request for shindig.
bq.  
bq.  
bq.  Summary
bq.  -------
bq.  
bq.  Ran into an issue where the server response was being partially un-escaped by the browser if it had escaped html entities in it.
bq.  
bq.  
bq.  This addresses bug SHINDIG-1761.
bq.      https://issues.apache.org/jira/browse/SHINDIG-1761
bq.  
bq.  
bq.  Diffs
bq.  -----
bq.  
bq.    http://svn.apache.org/repos/asf/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/MakeRequestHandler.java 1329959 
bq.  
bq.  Diff: https://reviews.apache.org/r/4896/diff
bq.  
bq.  
bq.  Testing
bq.  -------
bq.  
bq.  Tests still pass :)
bq.  
bq.  
bq.  Thanks,
bq.  
bq.  Dan
bq.  
bq.


                
> IE: fail to process file upload response with special characters (&quot;)
> -------------------------------------------------------------------------
>
>                 Key: SHINDIG-1761
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1761
>             Project: Shindig
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: 2.0.2
>         Environment: IE
>            Reporter: Xipan Xiao
>
> The server responds the following HTML content when uploading a file. Inside the <textarea> element, there is a JSON object. It is a valid JSON string, however, when this arrives the client side in an iframe, the JSON string extracted from the <textarea> element is decoded, thus all (&quot;) are converted to (") and that breaks the string. See the following code:
> var txt = iframe.document.getElementsByTagName("textarea")[0].value;//this txt is an invalid JSON string.
> For browsers like Firefox that has the window.FormData object, we're using AJAX to upload files and sever reponses are processed directly, without putting into an iframe/textarea element. For IE we can't avoid putting the response into an iframe.
> The HTML response that causes the problem:
> <html><head></head><body><textarea>{"http://example.com/upload":{"rc":200,"body":"{&quot;errorCode&quot;:&quot;InvalidRequest&quot;,&quot;errorMessage&quot;:&quot;An error occurred while handling reading the API request.  The request cannot be completed.&quot;}"}}</textarea></body></html>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira