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

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


The following commit(s) were added to refs/heads/master by this push:
     new d4bfd507 fix(GH-1432): Default content src when content tag is missing 
(#1573)
d4bfd507 is described below

commit d4bfd5079b701671286e31dea2dedc885481491c
Author: Norman Breau <[email protected]>
AuthorDate: Tue Mar 21 09:24:13 2023 -0700

    fix(GH-1432): Default content src when content tag is missing (#1573)
---
 framework/src/org/apache/cordova/ConfigXmlParser.java | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/framework/src/org/apache/cordova/ConfigXmlParser.java 
b/framework/src/org/apache/cordova/ConfigXmlParser.java
index ca3cbdaa..0b92e96b 100644
--- a/framework/src/org/apache/cordova/ConfigXmlParser.java
+++ b/framework/src/org/apache/cordova/ConfigXmlParser.java
@@ -34,6 +34,7 @@ public class ConfigXmlParser {
     private static String SCHEME_HTTP = "http";
     private static String SCHEME_HTTPS = "https";
     private static String DEFAULT_HOSTNAME = "localhost";
+    private static final String DEFAULT_CONTENT_SRC = "index.html";
 
     private String launchUrl;
     private String contentSrc;
@@ -110,6 +111,18 @@ public class ConfigXmlParser {
                 e.printStackTrace();
             }
         }
+
+        onPostParse();
+    }
+
+    private void onPostParse() {
+        // After parsing, if contentSrc is still null, it signals
+        // that <content> tag was completely missing. In this case,
+        // default it.
+        // https://github.com/apache/cordova-android/issues/1432
+        if (contentSrc == null) {
+            contentSrc = DEFAULT_CONTENT_SRC;
+        }
     }
 
     public void handleStartTag(XmlPullParser xml) {
@@ -140,7 +153,7 @@ public class ConfigXmlParser {
                 contentSrc = src;
             } else {
                 // Default
-                contentSrc = "index.html";
+                contentSrc = DEFAULT_CONTENT_SRC;
             }
         }
     }


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

Reply via email to