Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
illwieckz opened this issue Aug 16, 2019 · 1 comment · Fixed by #43
Closed

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

illwieckz opened this issue Aug 16, 2019 · 1 comment · Fixed by #43

Comments

@illwieckz
Copy link
Member

illwieckz commented Aug 16, 2019

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 illwieckz changed the title updater does not support alternate thumbnail information updater looks for medium thumbnail but it's not guaranteed to exist Aug 17, 2019
@illwieckz
Copy link
Member Author

illwieckz commented Aug 17, 2019

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.

illwieckz added a commit that referenced this issue Aug 17, 2019
medium thumbnail not always exist,
the full one is expected to always exist
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 a pull request may close this issue.

1 participant