Unvanquished / updater

QML based updater to install, update and launch the Unvanquished game.
https://unvanquished.net/download
16 stars 7 forks source link

updater looks for medium thumbnail but it's not guaranteed to exist #39

Closed illwieckz closed 4 years ago

illwieckz commented 4 years ago

this is probably a bug in wordpress, but we must support this way to do things.

in json produced by wordpress, current blog post has this content:

"comment_count": 0,
"comment_status": "open",
"thumbnail": "https://unvanquished.net/wp-content/uploads/2019/05/vega_monitor.display_text.1024-filtered-672x372.png",
"custom_fields": { },
"thumbnail_size": "post-thumbnail",
"thumbnail_images": {
    "full": {
        "url": "https://unvanquished.net/wp-content/uploads/2019/05/vega_monitor.display_text.1024-filtered.png",
        "width": 1024,
        "height": 1024
    },
    "thumbnail": {
        "url": "https://unvanquished.net/wp-content/uploads/2019/05/vega_monitor.display_text.1024-filtered-150x150.png",
        "width": 150,
        "height": 150
    },
    "medium": {
        "url": "https://unvanquished.net/wp-content/uploads/2019/05/vega_monitor.display_text.1024-filtered-300x300.png",
        "width": 300,
        "height": 300
    },
    "post-thumbnail": {
        "url": "https://unvanquished.net/wp-content/uploads/2019/05/vega_monitor.display_text.1024-filtered-672x372.png",
        "width": 672,
        "height": 372
    },
    "twentyfourteen-full-width": {
        "url": "https://unvanquished.net/wp-content/uploads/2019/05/vega_monitor.display_text.1024-filtered-1024x576.png",
        "width": 1024,
        "height": 576
    },
    "rpwe-thumbnail": {
        "url": "https://unvanquished.net/wp-content/uploads/2019/05/vega_monitor.display_text.1024-filtered-45x45.png",
        "width": 45,
        "height": 45
    },
    "sow-carousel-default": {
        "url": "https://unvanquished.net/wp-content/uploads/2019/05/vega_monitor.display_text.1024-filtered-272x182.png",
        "width": 272,
        "height": 182
    }
}

but previous blog post has this content:

"comment_count": 0,
"comment_status": "closed",
"thumbnail": null,
"custom_fields": { },
"thumbnail_size": "post-thumbnail",
"thumbnail_images": {
    "full": {
        "url": "https://unvanquished.net/wp-content/uploads/2019/05/20181210-055235-000.unvanquished-updater.png",
        "width": 1024,
        "height": 805
    }
}

As you see the thumbnail key is empty, but there is a thumbnail available somewhere else.

This is reproducible by clicking the right arrow button to try to display this blog post.

illwieckz commented 4 years ago

After some investigations I discovered the code is already looking for the thumbnails_images dictionary instead of the thumbnail key, but it looks for the medium thumbnail which is not guaranteed to exist. The fix is easy: always look for the full one, which is expected to always exist.