Treat mailto-URI parameters case-insensitive
RFC 6068 defines these parameters case-insensitive, yet we only supported lower-case values because the method Uri.getQueryParameters() treats parameter names case-sensitive. This patch introduces a wrapper class that implements case-insensitive parameter name matching. Note: commit message edited by cketti
This commit is contained in:
parent
900959c0d5
commit
a86354be7d
1 changed files with 20 additions and 1 deletions
|
@ -3257,7 +3257,8 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||||
* creating a new hierarchical dummy Uri object with the query
|
* creating a new hierarchical dummy Uri object with the query
|
||||||
* parameters of the original URI.
|
* parameters of the original URI.
|
||||||
*/
|
*/
|
||||||
Uri uri = Uri.parse("foo://bar?" + mailtoUri.getEncodedQuery());
|
CaseInsensitiveParamWrapper uri = new CaseInsensitiveParamWrapper(
|
||||||
|
Uri.parse("foo://bar?" + mailtoUri.getEncodedQuery()));
|
||||||
|
|
||||||
// Read additional recipients from the "to" parameter.
|
// Read additional recipients from the "to" parameter.
|
||||||
List<String> to = uri.getQueryParameters("to");
|
List<String> to = uri.getQueryParameters("to");
|
||||||
|
@ -3291,6 +3292,24 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class CaseInsensitiveParamWrapper {
|
||||||
|
private final Uri uri;
|
||||||
|
|
||||||
|
public CaseInsensitiveParamWrapper(Uri uri) {
|
||||||
|
this.uri = uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getQueryParameters(String key) {
|
||||||
|
final List<String> params = new ArrayList<String>();
|
||||||
|
for (String paramName : uri.getQueryParameterNames()) {
|
||||||
|
if (paramName.equalsIgnoreCase(key)) {
|
||||||
|
params.addAll(uri.getQueryParameters(paramName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class SendMessageTask extends AsyncTask<Void, Void, Void> {
|
private class SendMessageTask extends AsyncTask<Void, Void, Void> {
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
|
|
Loading…
Reference in a new issue