ensure repo fingerprints are always stored in all upper case

this makes sure that the repo fingerprints are always going to have the
same case, no matter how they were added.  Repo.fingerprint probably should
be converted to a BigInteger so that the comparison can be numeric rather
than String.  Then when the fingerprint needs to be displayed, it can be
formatted appropriately.
This commit is contained in:
Hans-Christoph Steiner 2014-01-31 20:47:57 -05:00
parent fc511fd94f
commit 220b3d1441

View File

@ -423,6 +423,7 @@ class RepoListFragment extends ListFragment
final Button addButton = alrt.getButton(DialogInterface.BUTTON_POSITIVE);
alrt.setTitle(R.string.repo_exists);
overwriteMessage.setVisibility(View.VISIBLE);
newFingerprint = newFingerprint.toUpperCase(Locale.ENGLISH);
if (repo.fingerprint == null && newFingerprint != null) {
// we're upgrading from unsigned to signed repo
overwriteMessage.setText(R.string.repo_exists_add_fingerprint);
@ -469,7 +470,7 @@ class RepoListFragment extends ListFragment
private void createNewRepo(String address, String fingerprint) {
ContentValues values = new ContentValues(2);
values.put(RepoProvider.DataColumns.ADDRESS, address);
values.put(RepoProvider.DataColumns.FINGERPRINT, fingerprint);
values.put(RepoProvider.DataColumns.FINGERPRINT, fingerprint.toUpperCase(Locale.ENGLISH));
RepoProvider.Helper.insert(getActivity().getContentResolver(), values);
finishedAddingRepo();
}