[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 90bfb1075d1: Treat empty mailto URIs properly under Android
From: |
Po Lu |
Subject: |
master 90bfb1075d1: Treat empty mailto URIs properly under Android |
Date: |
Fri, 20 Oct 2023 03:04:23 -0400 (EDT) |
branch: master
commit 90bfb1075d1615da7f80432d6c3465210bb96f0d
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Treat empty mailto URIs properly under Android
* java/org/gnu/emacs/EmacsOpenActivity.java (onCreate): If an
empty mailto: URI is supplied, ascertain if EXTRA_EMAIL is set,
then derive a mailto URI from that if so.
---
java/org/gnu/emacs/EmacsOpenActivity.java | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/java/org/gnu/emacs/EmacsOpenActivity.java
b/java/org/gnu/emacs/EmacsOpenActivity.java
index 0c0da6acd1f..f0f1068d3e2 100644
--- a/java/org/gnu/emacs/EmacsOpenActivity.java
+++ b/java/org/gnu/emacs/EmacsOpenActivity.java
@@ -462,10 +462,30 @@ public final class EmacsOpenActivity extends Activity
/* Escape the special characters $ and " before enclosing
the string within the `message-mailto' wrapper. */
fileName = uri.toString ();
+
+ /* If fileName is merely mailto: (absent either an email
+ address or content), then the program launching Emacs
+ conceivably provided such an URI to exclude non-email
+ programs from being enumerated within the Share dialog;
+ whereupon Emacs should replace it with any address
+ provided as EXTRA_EMAIL. */
+
+ if (fileName.equals ("mailto:"))
+ {
+ tem = intent.getCharSequenceExtra (Intent.EXTRA_EMAIL);
+
+ if (tem != null)
+ fileName = "mailto:" + tem;
+ }
+
+ /* Subsequently, escape fileName such that it is rendered
+ safe to append to the command line. */
+
fileName = (fileName
.replace ("\\", "\\\\")
.replace ("\"", "\\\"")
.replace ("$", "\\$"));
+
fileName = "(message-mailto \"" + fileName + "\" ";
/* Parse the intent itself to ascertain if any
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 90bfb1075d1: Treat empty mailto URIs properly under Android,
Po Lu <=