aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorPo Lu2023-11-14 10:57:18 +0800
committerPo Lu2023-11-14 10:57:18 +0800
commitbda31b2c6d62652c742e800b692dffd926f8284b (patch)
treedcf38d61157be0062402c7c6aceea931899614e6 /java
parent1fe949888057b0275da041288709bd5690501974 (diff)
downloademacs-bda31b2c6d62652c742e800b692dffd926f8284b.tar.gz
emacs-bda31b2c6d62652c742e800b692dffd926f8284b.zip
Properly merge EXTRA_EMAIL content with mailto URIs
* java/org/gnu/emacs/EmacsOpenActivity.java (onCreate): EXTRA_EMAIL is an array rather than a string, so insert its first element into an empty mailto URI.
Diffstat (limited to 'java')
-rw-r--r--java/org/gnu/emacs/EmacsOpenActivity.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/java/org/gnu/emacs/EmacsOpenActivity.java b/java/org/gnu/emacs/EmacsOpenActivity.java
index a5e8be2f238..5cca6cfcdff 100644
--- a/java/org/gnu/emacs/EmacsOpenActivity.java
+++ b/java/org/gnu/emacs/EmacsOpenActivity.java
@@ -414,6 +414,7 @@ public final class EmacsOpenActivity extends Activity
414 String subjectString, textString, attachmentString; 414 String subjectString, textString, attachmentString;
415 CharSequence tem; 415 CharSequence tem;
416 String tem1; 416 String tem1;
417 String[] emails;
417 StringBuilder builder; 418 StringBuilder builder;
418 List<Parcelable> list; 419 List<Parcelable> list;
419 420
@@ -466,16 +467,16 @@ public final class EmacsOpenActivity extends Activity
466 /* If fileName is merely mailto: (absent either an email 467 /* If fileName is merely mailto: (absent either an email
467 address or content), then the program launching Emacs 468 address or content), then the program launching Emacs
468 conceivably provided such an URI to exclude non-email 469 conceivably provided such an URI to exclude non-email
469 programs from being enumerated within the Share dialog; 470 programs from the Share dialog. Intents created thus
470 whereupon Emacs should replace it with any address 471 might hold the recipient email as a string array, which
471 provided as EXTRA_EMAIL. */ 472 is non-standard behavior. */
472 473
473 if (fileName.equals ("mailto:") || fileName.equals ("mailto://")) 474 if (fileName.equals ("mailto:") || fileName.equals ("mailto://"))
474 { 475 {
475 tem = intent.getCharSequenceExtra (Intent.EXTRA_EMAIL); 476 emails = intent.getStringArrayExtra (Intent.EXTRA_EMAIL);
476 477
477 if (tem != null) 478 if (emails[0] != null && emails.length > 0)
478 fileName = "mailto:" + tem; 479 fileName = "mailto:" + emails[0];
479 } 480 }
480 481
481 /* Subsequently, escape fileName such that it is rendered 482 /* Subsequently, escape fileName such that it is rendered