mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 11:12:15 -05:00
Use primary user ID for filename instead of short key ID
This commit is contained in:
parent
6383d19dd3
commit
be3e52884f
@ -43,6 +43,8 @@ import android.widget.TextView;
|
|||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
import org.sufficientlysecure.keychain.compatibility.ClipboardReflection;
|
import org.sufficientlysecure.keychain.compatibility.ClipboardReflection;
|
||||||
|
import org.sufficientlysecure.keychain.pgp.UncachedKeyRing;
|
||||||
|
import org.sufficientlysecure.keychain.pgp.UncachedPublicKey;
|
||||||
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
||||||
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
||||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||||
@ -230,9 +232,10 @@ public class ViewKeyAdvShareFragment extends LoaderFragment implements
|
|||||||
// Add replacement extra to send a text/plain file instead.
|
// Add replacement extra to send a text/plain file instead.
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
try {
|
try {
|
||||||
|
String primaryUserId = UncachedKeyRing.decodeFromData(content.getBytes()).
|
||||||
|
getPublicKey().getPrimaryUserIdWithFallback();
|
||||||
final File contentFile = new File(getActivity().getExternalCacheDir(),
|
final File contentFile = new File(getActivity().getExternalCacheDir(),
|
||||||
"key-" + KeyFormattingUtils.getShortKeyIdAsHexFromFingerprint(fingerprintData, false) +
|
primaryUserId + ".pgp.asc");
|
||||||
".pgp.asc");
|
|
||||||
FileWriter contentFileWriter = new FileWriter(contentFile, false);
|
FileWriter contentFileWriter = new FileWriter(contentFile, false);
|
||||||
BufferedWriter contentWriter = new BufferedWriter(contentFileWriter);
|
BufferedWriter contentWriter = new BufferedWriter(contentFileWriter);
|
||||||
contentWriter.write(content);
|
contentWriter.write(content);
|
||||||
|
Loading…
Reference in New Issue
Block a user