[ 
https://issues.apache.org/jira/browse/CB-11636?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15397396#comment-15397396
 ] 

ASF GitHub Bot commented on CB-11636:
-------------------------------------

GitHub user vladimir-kotikov opened a pull request:

    https://github.com/apache/cordova-lib/pull/470

    CB-11636 Handle attributes with quotes correctly

    This PR changes `mergeXml` inner implementation to avoid using 
`elementtree.findall()` with complex queries such as 
`tag[@attrib1="value1"][@attrib2="value2"]` to avoid issues with attributes w/ 
double quotes inside. Instead we use `findall('tag')` and the filter out 
unwanted candidates
    
    For more details see 
[CB-11636](https://issues.apache.org/jira/browse/CB-11636) and 
[CB-11613](https://issues.apache.org/jira/browse/CB-11613)

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/vladimir-kotikov/cordova-lib CB-11636

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-lib/pull/470.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #470
    
----
commit e0f556333040594ddca7920100a1e6b64da866cc
Author: Vladimir Kotikov <[email protected]>
Date:   2016-07-28T09:44:59Z

    CB-11636 Handle attributes with quotes correctly
    
    Avoid using complex queries in et.findall to prevent
    issues w/ quoted values. Previous approach w/ crafting
    complex query from attributes names and values was faulty
    when any of the attributes had double quotes or &quot;

----


> Merging config.xml w/ attributes containing &quot; fails.
> ---------------------------------------------------------
>
>                 Key: CB-11636
>                 URL: https://issues.apache.org/jira/browse/CB-11636
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CordovaCommon
>    Affects Versions: 1.4.0
>            Reporter: Vladimir Kotikov
>            Assignee: Vladimir Kotikov
>              Labels: reproduced, triaged, xml
>             Fix For: 1.4.1
>
>
> Repro steps:
> - Create an empty project
> - Add {{<preference name="name" value="my &quot;quoted&quot; value">}} to 
> config.xml
> - Add any of ios, windows or android platform
> - Call {{cordova prepare}}
> Expected:
> prepare succeds and preference copied to platform's config.xml
> Actual:
> prepare fails with unrelevant stacktrace:
> {noformat}
> No scripts found for hook "before_prepare".
> Checking config.xml for saved platforms that haven't been added to the project
> Checking for any plugins added to the project that have not been installed in 
> android platform
> No differences found between plugins added to project and installed in 
> android platform. Continuing...
> Generating config.xml from defaults for platform "android"
> net.js:647
>     throw new TypeError(
>     ^
> TypeError: Invalid data, chunk must be a string or buffer, not undefined
>     at WriteStream.Socket.write (net.js:647:11)
>     at WriteStream.stream.write 
> (D:\cordova\cordova-lib\cordova-common\node_modules\ansi\lib\newlines.js:36:21)
>     at Cursor.write 
> (D:\cordova\cordova-lib\cordova-common\node_modules\ansi\lib\ansi.js:157:23)
>     at CordovaLogger.log 
> (D:\cordova\cordova-lib\cordova-common\src\CordovaLogger.js:102:12)
>     at process.<anonymous> (D:\cordova\cordova-cli\src\cli.js:253:16)
>     at emitOne (events.js:96:13)
>     at process.emit (events.js:188:7)
>     at process._fatalException (bootstrap_node.js:254:26)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to