aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorPo Lu2023-10-20 15:03:56 +0800
committerPo Lu2023-10-20 15:03:56 +0800
commit90bfb1075d1615da7f80432d6c3465210bb96f0d (patch)
tree8feab13ae93e38576f9266116d4726078330332b /java
parente170869712295a97815044a89fa4157450f1674d (diff)
downloademacs-90bfb1075d1615da7f80432d6c3465210bb96f0d.tar.gz
emacs-90bfb1075d1615da7f80432d6c3465210bb96f0d.zip
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.
Diffstat (limited to 'java')
-rw-r--r--java/org/gnu/emacs/EmacsOpenActivity.java20
1 files changed, 20 insertions, 0 deletions
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
462 /* Escape the special characters $ and " before enclosing 462 /* Escape the special characters $ and " before enclosing
463 the string within the `message-mailto' wrapper. */ 463 the string within the `message-mailto' wrapper. */
464 fileName = uri.toString (); 464 fileName = uri.toString ();
465
466 /* If fileName is merely mailto: (absent either an email
467 address or content), then the program launching Emacs
468 conceivably provided such an URI to exclude non-email
469 programs from being enumerated within the Share dialog;
470 whereupon Emacs should replace it with any address
471 provided as EXTRA_EMAIL. */
472
473 if (fileName.equals ("mailto:"))
474 {
475 tem = intent.getCharSequenceExtra (Intent.EXTRA_EMAIL);
476
477 if (tem != null)
478 fileName = "mailto:" + tem;
479 }
480
481 /* Subsequently, escape fileName such that it is rendered
482 safe to append to the command line. */
483
465 fileName = (fileName 484 fileName = (fileName
466 .replace ("\\", "\\\\") 485 .replace ("\\", "\\\\")
467 .replace ("\"", "\\\"") 486 .replace ("\"", "\\\"")
468 .replace ("$", "\\$")); 487 .replace ("$", "\\$"));
488
469 fileName = "(message-mailto \"" + fileName + "\" "; 489 fileName = "(message-mailto \"" + fileName + "\" ";
470 490
471 /* Parse the intent itself to ascertain if any 491 /* Parse the intent itself to ascertain if any