Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Add folder column to generic CSV import format (#2371)

Leendert de Borst87e6fca76999
diff --git a/apps/server/Tests/AliasVault.UnitTests/Utilities/ImportExportTests.cs b/apps/server/Tests/AliasVault.UnitTests/Utilities/ImportExportTests.cs
index 7540df15b..32d763c2d 100644
--- a/apps/server/Tests/AliasVault.UnitTests/Utilities/ImportExportTests.cs
+++ b/apps/server/Tests/AliasVault.UnitTests/Utilities/ImportExportTests.cs
@@ -766,6 +766,7 @@ public class ImportExportTests
Assert.That(gmailCredential.Password, Is.EqualTo("your_password"));
Assert.That(gmailCredential.Notes, Is.EqualTo("Important email account"));
Assert.That(gmailCredential.TwoFactorSecret, Is.Empty);
+ Assert.That(gmailCredential.FolderPath, Is.EqualTo("Personal"));
});
// Test Facebook credential from template
@@ -778,6 +779,7 @@ public class ImportExportTests
Assert.That(facebookCredential.Password, Is.EqualTo("your_password"));
Assert.That(facebookCredential.Notes, Is.EqualTo("Social media account"));
Assert.That(facebookCredential.TwoFactorSecret, Is.Empty);
+ Assert.That(facebookCredential.FolderPath, Is.EqualTo("Personal/Social"));
});
// Test GitHub credential with TOTP from template
@@ -790,6 +792,7 @@ public class ImportExportTests
Assert.That(githubCredential.Password, Is.EqualTo("your_password"));
Assert.That(githubCredential.Notes, Is.EqualTo("Development platform"));
Assert.That(githubCredential.TwoFactorSecret, Is.EqualTo("your_totp_secret_here"));
+ Assert.That(githubCredential.FolderPath, Is.EqualTo("Work"));
});
// Test Secure Note (no username/password) from template
@@ -802,6 +805,7 @@ public class ImportExportTests
Assert.That(secureNoteCredential.Password, Is.Empty);
Assert.That(secureNoteCredential.Notes, Is.EqualTo("Important information or notes without login credentials"));
Assert.That(secureNoteCredential.TwoFactorSecret, Is.Empty);
+ Assert.That(secureNoteCredential.FolderPath, Is.Null);
});
}
@@ -1066,7 +1070,7 @@ public class ImportExportTests
// Assert
Assert.That(template, Is.Not.Null);
- Assert.That(template, Does.Contain("service_name,url,username,password,totp_secret,notes"));
+ Assert.That(template, Does.Contain("service_name,url,username,password,totp_secret,notes,folder"));
Assert.That(template, Does.Contain("Gmail"));
Assert.That(template, Does.Contain("Facebook"));
Assert.That(template, Does.Contain("GitHub"));
diff --git a/apps/server/Utilities/AliasVault.ImportExport/Importers/GenericCsvImporter.cs b/apps/server/Utilities/AliasVault.ImportExport/Importers/GenericCsvImporter.cs
index b739cd236..da407901e 100644
--- a/apps/server/Utilities/AliasVault.ImportExport/Importers/GenericCsvImporter.cs
+++ b/apps/server/Utilities/AliasVault.ImportExport/Importers/GenericCsvImporter.cs
@@ -25,13 +25,13 @@ public static class GenericCsvImporter
var template = new StringBuilder();
// Add headers
- template.AppendLine("service_name,url,username,password,totp_secret,notes");
+ template.AppendLine("service_name,url,username,password,totp_secret,notes,folder");
// Add example rows
- template.AppendLine("Gmail,https://gmail.com,[email protected],your_password,,Important email account");
- template.AppendLine("Facebook,https://facebook.com,your.username,your_password,,Social media account");
- template.AppendLine("GitHub,https://github.com,developer_username,your_password,your_totp_secret_here,Development platform");
- template.AppendLine("Secure Note,,,,,\"Important information or notes without login credentials\"");
+ template.AppendLine("Gmail,https://gmail.com,[email protected],your_password,,Important email account,Personal");
+ template.AppendLine("Facebook,https://facebook.com,your.username,your_password,,Social media account,Personal/Social");
+ template.AppendLine("GitHub,https://github.com,developer_username,your_password,your_totp_secret_here,Development platform,Work");
+ template.AppendLine("Secure Note,,,,,\"Important information or notes without login credentials\",");
return template.ToString();
}
@@ -70,7 +70,8 @@ public static class GenericCsvImporter
Username = record.Username?.Trim(),
Password = record.Password?.Trim(),
TwoFactorSecret = record.TotpSecret?.Trim(),
- Notes = record.Notes?.Trim()
+ Notes = record.Notes?.Trim(),
+ FolderPath = string.IsNullOrWhiteSpace(record.Folder) ? null : record.Folder.Trim(),
};
credentials.Add(credential);
diff --git a/apps/server/Utilities/AliasVault.ImportExport/Models/Imports/GenericCsvRecord.cs b/apps/server/Utilities/AliasVault.ImportExport/Models/Imports/GenericCsvRecord.cs
index 4b6820c58..3cb700fac 100644
--- a/apps/server/Utilities/AliasVault.ImportExport/Models/Imports/GenericCsvRecord.cs
+++ b/apps/server/Utilities/AliasVault.ImportExport/Models/Imports/GenericCsvRecord.cs
@@ -50,4 +50,10 @@ public class GenericCsvRecord
/// </summary>
[Name("notes")]
public string? Notes { get; set; }
+
+ /// <summary>
+ /// Gets or sets the folder path (optional). Supports multi-level paths separated by "/" (e.g., "Personal/Social").
+ /// </summary>
+ [Name("folder")]
+ public string? Folder { get; set; }
}