Skip to content

[ACTV-280] Fix template media refs not extracted for "Upload media for deck"#1257

Merged
abdnh merged 3 commits intomainfrom
ACTV-280
Mar 12, 2026
Merged

[ACTV-280] Fix template media refs not extracted for "Upload media for deck"#1257
abdnh merged 3 commits intomainfrom
ACTV-280

Conversation

@abdnh
Copy link
Contributor

@abdnh abdnh commented Mar 9, 2026

Related issues

See ACTV-280. A follow-up to #1252.

Proposed changes

The "Upload media for deck" option was not extracting media references in note types.

How to reproduce

  • Create a new AnkiHub deck and upload it without media (You can use the deck attached in [ACTV-280] Improve deck media detection #1252).
  • Use AnkiHub > Upload media for deck to upload the media later.
  • Confirm media files referenced in note types are uploaded by creating a new Anki profile and syncing the deck there 1.

Footnotes

  1. After switching profiles, make sure to restart Anki completely because Anki caches media files viewed across profiles.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request fixes a bug that caused media files referenced within Anki note type templates to be omitted when a user utilized the 'Upload media for deck' feature. The changes ensure that the media extraction logic now comprehensively scans both individual note fields and the underlying note type definitions, guaranteeing that all associated media are correctly identified and uploaded for a complete and accurate deck synchronization.

Highlights

  • Bug Fix: Resolved an issue where media references embedded within Anki note type templates were not being extracted during the 'Upload media for deck' process.
  • Media Extraction Logic: Enhanced the media_names_for_ankihub_deck function to correctly identify and include media files referenced in both note fields and note type templates.
  • Test Coverage: Added a new unit test case to verify that media embedded in note type templates are properly detected and included in the media upload.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • ankihub/db/db.py
    • Imported the get_media_names_from_note_type utility function to facilitate media extraction from note types.
    • Modified the media_names_for_ankihub_deck method to fetch note types associated with the deck's notes and extract media names from their templates, combining these with media names found in note fields.
  • tests/addon/test_unit.py
    • Modified the setup_method_fixture to inject an image reference (_test4.jpg) into the qfmt (question format) of a basic note type template for testing.
    • Updated the assertion in test_basic to include _test4.jpg in the expected set of media names, confirming its successful extraction from the note type template.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@abdnh abdnh merged commit f04b07f into main Mar 12, 2026
8 checks passed
@abdnh abdnh deleted the ACTV-280 branch March 12, 2026 18:35
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.

2 participants