identity: skip reserved identity import names

This commit is contained in:
DeFiDude
2026-06-13 17:59:29 -06:00
parent b6f07161ef
commit f481f0c3de
2 changed files with 7 additions and 4 deletions
+4 -2
View File
@@ -84,8 +84,10 @@ String IdentityManager::importIdentityPath() const {
entry.close();
String lower = name;
lower.toLowerCase();
bool legacyIdentityKey = lower == "identity.key" || lower.endsWith("/identity.key");
bool importCandidate = lower.endsWith(".identity") || (lower.endsWith(".key") && !legacyIdentityKey);
bool reservedIdentityFile = lower == "identity.key" || lower.endsWith("/identity.key") ||
lower == "identity.identity" || lower.endsWith("/identity.identity");
bool importCandidate = !reservedIdentityFile &&
(lower.endsWith(".identity") || lower.endsWith(".key"));
if (importCandidate) {
candidate = name.startsWith("/") ? name : String(SD_PATH_IDENTITY_DIR) + "/" + name;
candidates++;
+3 -2
View File
@@ -482,8 +482,9 @@ void LvSettingsScreen::buildItems() {
if (!entry.isDirectory()) {
String name = entry.name();
name.toLowerCase();
bool legacyIdentityKey = name == "identity.key" || name.endsWith("/identity.key");
if (name.endsWith(".identity") || (name.endsWith(".key") && !legacyIdentityKey)) {
bool reservedIdentityFile = name == "identity.key" || name.endsWith("/identity.key") ||
name == "identity.identity" || name.endsWith("/identity.identity");
if (!reservedIdentityFile && (name.endsWith(".identity") || name.endsWith(".key"))) {
identityFiles++;
}
}