Improve credit card naming and add Dashlane tests #503
+905
−9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🎟️ Tracking
TBD
📔 Objective
This change introduces several improvements to the CXF (Credential Exchange Format) importer, focusing on better handling of credit card items and expanding test coverage.
The primary goal is to enhance the user experience when importing credit card data from CXF files by providing more sensible default names for items. A secondary objective is to add comprehensive integration tests for Dashlane exports to ensure compatibility and prevent regressions.
Behavioral Changes:
When importing a credit card from a CXF file, if the item's main title is empty or consists only of whitespace, the importer will now use the cardholder's name as the item name. If both the title and cardholder name are absent, it will fall back to "Untitled Card". This prevents the creation of nameless credit card entries in the vault.
Specific Changes:
cxf/import.rs
:add_item
helper function has been updated to accept an optionalcustom_name
parameter, allowing the item's name to be overridden during creation.item.title
is blank. If it is, the cardholder's name (card.cardholder_name
) is used as the item name. A fallback to "Untitled Card" is implemented if the cardholder's name is also unavailable.cxf/tests/dashlane_import_test.rs
:test_import_dashlane
) that parses a sampledashlane_export.json
file and asserts that all items (Logins, Cards, Notes, Identities, etc.) are correctly converted into Bitwarden cipher objects.resources/dashlane_export.json
:cxf/tests/mod.rs
:dashlane_import_test
module is now included in the test suite.⏰ Reminders before review
team
🦮 Reviewer guidelines
:+1:
) or similar for great changes:memo:
) or ℹ️ (:information_source:
) for notes or general info:question:
) for questions:thinking:
) or 💭 (:thought_balloon:
) for more open inquiry that's not quite a confirmedissue and could potentially benefit from discussion
:art:
) for suggestions / improvements:x:
) or:warning:
) for more significant problems or concerns needing attention:seedling:
) or ♻️ (:recycle:
) for future improvements or indications of technical debt:pick:
) for minor or nitpick changes