Force-of-Wind / fowsim

Force of Will Online Simulator
GNU Affero General Public License v3.0
9 stars 6 forks source link

The 'card_image' attribute has no file associated with it. #109

Closed cr08 closed 2 years ago

cr08 commented 2 years ago

Came across this while trying to get my own dev copy running. So far I've encountered it on two pages: The search results page and the card details page for cards -without- card images downloaded yet.

Reviewing the template files, it appears in these two instances (and possibly others I haven't found) it is explicitly calling for card images even if they do not exist in the system. With the current status of card image availability even after tweaking downloadCardImages to scrape the current page layout on FOWTCG, this seems very relevant.

As a hacky workaround, adding a simple if/then/else block around the call for card images fixes it. As an example:

https://github.com/Force-of-Wind/fowsim/blob/ff3f6f7e6ee67c14c7884831f49c0e883062eae4/cardDatabase/templates/cardDatabase/html/search.html#L25

Changed to: {% if card.card_image %} data-card-image-url="{{ card.card_image.url }}" data-card-image-urls='{% get_card_img_urls card %}'> {% else %} data-card-image-url="img/fow-cardback.jpg"> {% endif %}

And:

https://github.com/Force-of-Wind/fowsim/blob/ff3f6f7e6ee67c14c7884831f49c0e883062eae4/cardDatabase/templates/cardDatabase/html/view_card.html#L6

to:

{% block image_preview_url %} {% if card.card_image %} {{ card.card_image.url }} {% else %} Image Missing<br /> {% endif %} {% endblock %}