Skip to content

fix: use media_path from config instead of hardcoded value#342

Merged
rochacbruno merged 1 commit intomainfrom
fix/media-path-config
Aug 16, 2025
Merged

fix: use media_path from config instead of hardcoded value#342
rochacbruno merged 1 commit intomainfrom
fix/media-path-config

Conversation

@rochacbruno
Copy link
Copy Markdown
Owner

Summary

This PR fixes a bug where the media folder name was hardcoded to "media" instead of using the configurable media_path value from the site configuration.

Problem

The find_matching_file function in content.rs was using a hardcoded "media" string instead of respecting the user's configured media_path setting in marmite.yaml.

Solution

  • Pass media_path from site configuration through the function chain
  • Update get_card_image and get_banner_image functions to accept the media_path parameter
  • Fix recursive call to get_banner_image within get_card_image
  • Update all related tests to pass the media_path parameter

Changes

  • Modified src/content.rs:
    • Updated function signatures to accept media_path parameter
    • Replaced hardcoded "media" with configurable value
  • Modified src/tests/content.rs:
    • Updated test calls to include media_path parameter
  • Modified src/tests/image_provider.rs:
    • Fixed clippy warning (unrelated minor fix)

Test plan

  • All existing tests pass
  • cargo test - 220 tests pass
  • mask fmt - Code formatted
  • mask check - No clippy warnings
  • mask pedantic - No pedantic warnings

Breaking changes

None - This is an internal fix that maintains backward compatibility.

- Pass media_path from site configuration to find_matching_file function
- Update get_card_image and get_banner_image to accept media_path parameter
- Fix recursive call to get_banner_image within get_card_image
- Update all tests to pass media_path parameter
- Fix clippy warning in image_provider test

This allows users to configure a custom media folder name in their
marmite.yaml configuration file instead of being forced to use 'media'.
@rochacbruno rochacbruno merged commit 6f4a0c6 into main Aug 16, 2025
3 checks passed
@rochacbruno rochacbruno deleted the fix/media-path-config branch August 16, 2025 21:09
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.

1 participant