mirror of
https://github.com/ankitects/anki.git
synced 2026-11-30 10:54:33 -06:00
## Linked issue (required) Fixes #5342 ## Summary / motivation (required) When installing an add-on from AnkiWeb, Anki currently derives the displayed name from the AnkiWeb download filename and passes it as overriding manifest metadata. This can alter names when the filename has been sanitized by AnkiWeb. This change prefers a non-empty `name` from a valid packaged `manifest.json` when available, while retaining the existing AnkiWeb-derived name as a fallback. ## Steps to reproduce (required, use N/A if not applicable) 1. Package an add-on with a `manifest.json` whose `name` contains a character that is removed from the AnkiWeb download filename, such as `&` or `𝕾`. 2. Upload the add-on to AnkiWeb and install it from there. 3. Open the Add-ons dialog and observe that the displayed name is derived from the sanitized AnkiWeb filename rather than the packaged `name`. ## How to test (required) ### Checklist (minimum) - [x] I ran `./ninja check` or an equivalent relevant check locally. - [x] I added or updated tests when the change is non-trivial or behavior changed. ### Details Added tests verifying that: - a non-empty `name` from a valid packaged manifest is preferred for AnkiWeb installs; - the existing filename-derived name remains the fallback when no usable packaged name is available. `./ninja check` passes locally. Also manually verified with a local build by installing an AnkiWeb add-on whose packaged name differed from its AnkiWeb title; the Add-ons dialog used the packaged name. ## Before / after behavior (optional) Before: AnkiWeb installs always use the filename-derived name, overriding a `name` supplied in the packaged manifest. After: A non-empty packaged `name` is preferred when available; otherwise, the existing AnkiWeb-derived name is retained. ## Risk / compatibility / migration (optional) Low. The change is limited to AnkiWeb add-on installation, and the existing fallback behavior is preserved for add-ons without a usable packaged name. ## UI evidence (required for visual changes; otherwise N/A) N/A ## Scope - [x] This PR is focused on one change (no unrelated edits).