PullHotlinkedImages does not replace images again after post is edited

Hey,


Related to:

Actually, the issue with downloading images on edited topics with system doesn’t seems to be fully solved. Sorry for not noticing it earlier. For example this one or this one.

As reminder, in our case, it’s an automatic category change (using API).

My client still have topics where PullHotlinkedImages does nothing no matter what:

  • From a simple Save Edit or even
  • Post.update_all(baked_version: nil) + Jobs.enqueue_in(10, :pull_hotlinked_images, post_id: <id>)

However, it works if you create a new topic with the same content.

@david

1 Like

This is strange, there must be something different about the topic being created via the API.

How exactly are the posts created? Can you share the API parameters you’re using?

2 Likes

When I say “new topic”, I mean directly on Discourse, not via API.

Originally, it’s a topic created from WP-Discourse; so should be this code:

For example, if you look at the first edit of the topic linked above, You see well the system replacing the images. So, WP-Discourse is likely not an issue.

Later, the original author updated the Wordpress post, the Discourse topic got updated and the original images are back:

Then a category change happened, and from there PullGotlinkedImages does nothing:


If you want the code used for the category change, it’s something like that:

image

3 Likes

Perfect, thanks for the detailed summary! I think the problem is here:

I managed to produce a failing test case for this. It seems we only do the URL replacement when the image is first downloaded. If we have already downloaded the image once, it won’t be replaced again.

This is a failing test which demonstrates the issue

I will add it to my list to fix. I should be able to get to it in the next few weeks.

7 Likes

Awesome!

It seems you’re right, I’ve checked others topics, and I can see that earlier the system did replace well the images.

Any news/status on this?

Nothing yet, but it’s still on the list!

1 Like

This should be resolved following

I added a spec for this case so that it doesn’t regress in future.

4 Likes

I just fastly edited/saved few topics manually which was edited by system and it seems that PullHotlinkedImages is working now. Will try the command line later, but no doubt it will working fine.

Thanks!

1 Like

This topic was automatically closed after 2 days. New replies are no longer allowed.