Skip to content

Commit

Permalink
CB-14135(ios): escape all single quotes from name in Podfile (#731)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored Dec 2, 2019
1 parent a5a009c commit c1a6640
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bin/templates/scripts/cordova/lib/Podfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ Podfile.prototype.__parseForPods = function (text) {
};

Podfile.prototype.escapeSingleQuotes = function (string) {
return string.replace('\'', '\\\'');
return string.replace(/'/g, '\\\'');
};

Podfile.prototype.getTemplate = function () {
Expand Down
13 changes: 12 additions & 1 deletion tests/spec/unit/Podfile.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,20 @@ describe('unit tests for Podfile module', function () {
expect(actualProjectName).toBe(expectedProjectName);
});

it('Test 011 : escapes double single quotes in project name when writing a Podfile', function () {
podfile.before_install();

var projectName = 'l\'etat c\'est moi';

var expectedProjectName = 'l\\\'etat c\\\'est moi';
var actualProjectName = podfile.escapeSingleQuotes(projectName);

expect(actualProjectName).toBe(expectedProjectName);
});

});

it('Test 011 : tear down', function () {
it('Test 012 : tear down', function () {
podfile.destroy();

var text = '// DO NOT MODIFY -- auto-generated by Apache Cordova\n';
Expand Down

0 comments on commit c1a6640

Please sign in to comment.