Skip to content

Conversation

@saikumarvasa100-hash
Copy link

@saikumarvasa100-hash saikumarvasa100-hash commented Nov 13, 2025

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.

Fixes hacs#4863

When installing themes with release assets containing .yaml files, HACS was downloading ALL release assets instead of only the theme .yaml files.

Fixes hacs#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.
@ludeeus
Copy link
Member

ludeeus commented Nov 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
Copy link
Author

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.
@ludeeus ludeeus added the Breaking Change Added to pull requests that adds a breaking change label Nov 13, 2025
Copy link
Contributor

Copilot AI left a 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 the gather_files_to_download() method to skip non-yaml files for theme releases.

  • Adds filtering logic to restrict theme release downloads to .yaml files 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.

for release in releaseobjects or []:
if ref == release.tag_name:
for asset in release.assets or []:
# For themes, only download .yaml files from release assets
Copy link

Copilot AI Nov 14, 2025

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 the for asset in release.assets or []: loop.

Suggested change
# For themes, only download .yaml files from release assets
# For themes, only download .yaml files from release assets

Copilot uses AI. Check for mistakes.
Comment on lines +234 to +237
def test_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"
Copy link

Copilot AI Nov 14, 2025

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 inside test_gather_plugin_different_card_name instead of being at the module level. The def statement should be at the same indentation level as other test functions (no leading spaces), not indented within the previous function.

Suggested change
def test_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"
def test_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"

Copilot uses AI. Check for mistakes.
def test_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"
Copy link

Copilot AI Nov 14, 2025

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.

Suggested change
repository.ref = "1.0.0"
repository.ref = "1.0.0"

Copilot uses AI. Check for mistakes.
Comment on lines +234 to +237
def test_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"
Copy link

Copilot AI Nov 14, 2025

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.

Suggested change
def test_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"
def test_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"

Copilot uses AI. Check for mistakes.
Copy link
Member

@ludeeus ludeeus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the status to reflect the state.

@hacs-bot hacs-bot bot marked this pull request as draft December 6, 2025 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking Change Added to pull requests that adds a breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Installing themes downloads every asset from the GitHub release

2 participants