Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix numeric deck and notetype names being treated as ids when importing csv #3748

Merged
merged 2 commits into from
Jan 25, 2025

Conversation

iamllama
Copy link
Contributor

Reported in https://forums.ankiweb.net/t/import-problem-deck-field-is-ignored-since-version-24-11

Fixes numeric deck and notetype names being treated as ids in #deck:..., or in the specified deck/notetype column

DeckIdsByNameOrId::get, Collection::deck_id_by_name_or_id and Collection::notetype_by_name_or_id are modified to fallback to treating ids as names if said deck/notetype id is nonexistent

Modifying Collection.deck_id_by_name_or_id may seem redundant, as the metadata deck goes through DeckIdsByNameOrId::get anyway, but since its used by the import options page, it's kept for consistency when dealing with #deck:<numeric>

The only breakage I can think of is when an exporter exports notes from a deck with a name that's the same as one of the importer's decks' ids, in which case the deck with that id would be used instead of making a new deck with the id as the name. But this seems highly pathological, and is identical to existing behaviour regardless.

@dae
Copy link
Member

dae commented Jan 25, 2025

Another good change - thanks again!

@dae dae merged commit 9b2987b into ankitects:main Jan 25, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants