mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 11:12:15 -05:00
deal with non-existent user ids during import (#994)
This commit is contained in:
parent
9cf800bcd8
commit
5057ea1744
@ -21,6 +21,7 @@ import android.content.Context;
|
|||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
|
||||||
|
import org.sufficientlysecure.keychain.R;
|
||||||
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||||
import org.sufficientlysecure.keychain.pgp.UncachedKeyRing;
|
import org.sufficientlysecure.keychain.pgp.UncachedKeyRing;
|
||||||
@ -287,7 +288,7 @@ public class ImportKeysListEntry implements Serializable, Parcelable {
|
|||||||
|
|
||||||
// if there was no user id flagged as primary, use the first one
|
// if there was no user id flagged as primary, use the first one
|
||||||
if (mPrimaryUserId == null) {
|
if (mPrimaryUserId == null) {
|
||||||
mPrimaryUserId = mUserIds.get(0);
|
mPrimaryUserId = context.getString(R.string.user_id_none);
|
||||||
}
|
}
|
||||||
|
|
||||||
mKeyId = key.getKeyId();
|
mKeyId = key.getKeyId();
|
||||||
|
@ -186,12 +186,14 @@ public class UncachedPublicKey {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns primary user id if existing. If not, return first encountered user id.
|
* Returns primary user id if existing. If not, return first encountered user id. If there
|
||||||
|
* is no user id, return null (this can only happen for not yet canonicalized keys during import)
|
||||||
*/
|
*/
|
||||||
public String getPrimaryUserIdWithFallback() {
|
public String getPrimaryUserIdWithFallback() {
|
||||||
String userId = getPrimaryUserId();
|
String userId = getPrimaryUserId();
|
||||||
if (userId == null) {
|
if (userId == null) {
|
||||||
userId = (String) mPublicKey.getUserIDs().next();
|
Iterator<String> it = mPublicKey.getUserIDs();
|
||||||
|
userId = it.hasNext() ? it.next() : null;
|
||||||
}
|
}
|
||||||
return userId;
|
return userId;
|
||||||
}
|
}
|
||||||
|
@ -1024,6 +1024,12 @@
|
|||||||
<string name="passp_cache_notif_clear">"Clear Cache"</string>
|
<string name="passp_cache_notif_clear">"Clear Cache"</string>
|
||||||
<string name="passp_cache_notif_pwd">"Passphrase"</string>
|
<string name="passp_cache_notif_pwd">"Passphrase"</string>
|
||||||
|
|
||||||
|
<!-- First Time -->
|
||||||
|
<string name="first_time_text1">"Take back your privacy with OpenKeychain!"</string>
|
||||||
|
<string name="first_time_create_key">"Create my key"</string>
|
||||||
|
<string name="first_time_import_key">"Import from file"</string>
|
||||||
|
<string name="first_time_skip">"Skip Setup"</string>
|
||||||
|
|
||||||
<!-- unsorted -->
|
<!-- unsorted -->
|
||||||
<string name="section_certifier_id">"Certifier"</string>
|
<string name="section_certifier_id">"Certifier"</string>
|
||||||
<string name="section_cert">"Certificate Details"</string>
|
<string name="section_cert">"Certificate Details"</string>
|
||||||
@ -1054,11 +1060,6 @@
|
|||||||
<string name="error_multi_not_supported">"Saving of multiple files not supported. This is a limitation on current Android."</string>
|
<string name="error_multi_not_supported">"Saving of multiple files not supported. This is a limitation on current Android."</string>
|
||||||
<string name="key_colon">"Key:"</string>
|
<string name="key_colon">"Key:"</string>
|
||||||
<string name="exchange_description">"To start a key exchange, choose the number of participants on the right side, then hit the “Start exchange” button.\n\nYou will be asked two more questions to make sure only the right participants are in the exchange and their fingerprints are correct."</string>
|
<string name="exchange_description">"To start a key exchange, choose the number of participants on the right side, then hit the “Start exchange” button.\n\nYou will be asked two more questions to make sure only the right participants are in the exchange and their fingerprints are correct."</string>
|
||||||
|
<string name="user_id_none"><![CDATA[<none>]]></string>
|
||||||
<!-- First Time -->
|
|
||||||
<string name="first_time_text1">"Take back your privacy with OpenKeychain!"</string>
|
|
||||||
<string name="first_time_create_key">"Create my key"</string>
|
|
||||||
<string name="first_time_import_key">"Import from file"</string>
|
|
||||||
<string name="first_time_skip">"Skip Setup"</string>
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user