Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1.5k
Restrict theme asset downloads to .yaml files#4923
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Restrict theme asset downloads to .yaml files#4923
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Fixeshacs#4863When installing themes with release assets containing .yaml files, HACS was downloading ALL release assets instead of only the theme .yaml files.Fixeshacs#4863When installing themes with release assets containing .yaml files, HACS was downloading ALL release assets instead of only the theme .yaml files.This fix adds a filter in the gather_files_to_download() method to skip non-.yaml files when downloading theme release assets. This ensures only .yaml theme files are downloaded, preventing unwanted files like zip archives from being installed.
ludeeus commentedNov 13, 2025
FYI: This is not a fix, this is a breaking change. Please also add coverage that ensure this do what you change here. |
saikumarvasa100-hash commentedNov 13, 2025
Thank you for the feedback! I understand this is a breaking change, not just a fix. I'm working on adding test coverage now to ensure the change works as intended. I'll update the PR shortly with tests that verify only .yaml files are downloaded for theme release assets. |
…hat only .yaml files are downloaded from theme release assets, excluding non-.yaml files like images, zips, and markdown files.Add test for gathering theme files from release assets, ensuring only .yaml files are included.
Set repository reference to version 1.0.0 for testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Pull Request Overview
This PR fixes an issue where HACS was downloading all release assets when installing themes, instead of only.yaml theme files. The fix adds a filter in thegather_files_to_download() method to skip non-yaml files for theme releases.
- Adds filtering logic to restrict theme release downloads to
.yamlfiles only - Includes a test case to verify the new filtering behavior
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| custom_components/hacs/repositories/base.py | Adds conditional logic to filter out non-.yaml files when downloading theme release assets |
| tests/helpers/download/test_gather_files_to_download.py | Adds test case to verify only.yaml files are downloaded from theme release assets |
💡Add Copilot custom instructions for smarter, more guided reviews.Learn how to get started.
| forreleaseinreleaseobjectsor []: | ||
| ifref==release.tag_name: | ||
| forassetinrelease.assetsor []: | ||
| # For themes, only download .yaml files from release assets |
CopilotAINov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Inconsistent indentation: This line has excessive indentation (appears to have multiple leading spaces beyond what's needed). It should align with the surrounding code at the proper indentation level for code inside thefor asset in release.assets or []: loop.
| # For themes, only download .yaml files from release assets | |
| # For themes, only download .yaml files from release assets |
| deftest_gather_theme_files_from_release_only_yaml(repository_theme): | ||
| """Test that only .yaml files are downloaded from theme release assets.""" | ||
| repository=repository_theme | ||
| repository.ref="1.0.0" |
CopilotAINov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Incorrect indentation: This test function is nested insidetest_gather_plugin_different_card_name instead of being at the module level. Thedef statement should be at the same indentation level as other test functions (no leading spaces), not indented within the previous function.
| deftest_gather_theme_files_from_release_only_yaml(repository_theme): | |
| """Test that only .yaml files are downloaded from theme release assets.""" | |
| repository=repository_theme | |
| repository.ref="1.0.0" | |
| deftest_gather_theme_files_from_release_only_yaml(repository_theme): | |
| """Test that only .yaml files are downloaded from theme release assets.""" | |
| repository=repository_theme | |
| repository.ref="1.0.0" |
| deftest_gather_theme_files_from_release_only_yaml(repository_theme): | ||
| """Test that only .yaml files are downloaded from theme release assets.""" | ||
| repository=repository_theme | ||
| repository.ref="1.0.0" |
CopilotAINov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Incorrect indentation: This line has inconsistent indentation compared to the rest of the function body. It should be aligned with line 236 (4 spaces), not 8 spaces.
| repository.ref="1.0.0" | |
| repository.ref="1.0.0" |
| deftest_gather_theme_files_from_release_only_yaml(repository_theme): | ||
| """Test that only .yaml files are downloaded from theme release assets.""" | ||
| repository=repository_theme | ||
| repository.ref="1.0.0" |
CopilotAINov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Variable test_gather_theme_files_from_release_only_yaml is not used.
| deftest_gather_theme_files_from_release_only_yaml(repository_theme): | |
| """Test that only .yaml files are downloaded from theme release assets.""" | |
| repository=repository_theme | |
| repository.ref="1.0.0" | |
| deftest_gather_theme_files_from_release_only_yaml(repository_theme): | |
| """Test that only .yaml files are downloaded from theme release assets.""" | |
| repository=repository_theme | |
| repository.ref="1.0.0" |
Uh oh!
There was an error while loading.Please reload this page.
Closes#4863
When installing themes with release assets containing .yaml files, HACS was downloading ALL release assets instead of only the theme .yaml files.
This fix adds a filter in the gather_files_to_download() method to skip non-.yaml files when downloading theme release assets. This ensures only .yaml theme files are downloaded, preventing unwanted files like zip archives from being installed.