mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
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
@ -3257,7 +3257,8 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
* creating a new hierarchical dummy Uri object with the query
|
||||
* 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.
|
||||
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> {
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
|
Loading…
Reference in New Issue
Block a user