You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by jc...@apache.org on 2019/12/02 14:07:55 UTC

[cordova-ios] branch master updated: CB-14135(ios): escape all single quotes from name in Podfile (#731)

This is an automated email from the ASF dual-hosted git repository.

jcesarmobile pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-ios.git


The following commit(s) were added to refs/heads/master by this push:
     new c1a6640  CB-14135(ios): escape all single quotes from name in Podfile (#731)
c1a6640 is described below

commit c1a6640758d1e95f7f7e0dbca980df8780a2adf4
Author: jcesarmobile <jc...@gmail.com>
AuthorDate: Mon Dec 2 15:07:45 2019 +0100

    CB-14135(ios): escape all single quotes from name in Podfile (#731)
---
 bin/templates/scripts/cordova/lib/Podfile.js |  2 +-
 tests/spec/unit/Podfile.spec.js              | 13 ++++++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/bin/templates/scripts/cordova/lib/Podfile.js b/bin/templates/scripts/cordova/lib/Podfile.js
index 7106ff6..e78a1f3 100644
--- a/bin/templates/scripts/cordova/lib/Podfile.js
+++ b/bin/templates/scripts/cordova/lib/Podfile.js
@@ -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 () {
diff --git a/tests/spec/unit/Podfile.spec.js b/tests/spec/unit/Podfile.spec.js
index 9618c39..96be921 100644
--- a/tests/spec/unit/Podfile.spec.js
+++ b/tests/spec/unit/Podfile.spec.js
@@ -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';


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org