gatsbyjs/gatsby-source-wordpress-experimental

How are links to media files in post content processed?

Closed this issue · 4 comments

I am working with a rather large Wordpress Site and many of the Posts contain links to pdf files. Sometimes, it works as expected and the Links in the Post's content html are change to /static/xxxx/file-name.pdf

But often, the relative link in the Blog post is not changed at all and it still points to a relative link of /wp-content/uploads/... which, of course, does not exist on the gatsby page. This happens, even though the links are added in the posts' content field the same way.

I could not find any documentation about how these relative links in Posts are processed. And some clarification on how I can ensure it works more reliably. Thank you!

acao commented

this is not the expected behaviour unfortunately, so we will treat this as a known bug, as there are several other similar conditions that cause urls in post body to not be processed properly

if you're able, it would be helpful to have a repo where we can reproduce this bug for testing!

At the moment, it is hard for me to make a reproduction repo as this is quite a complex project. Also, may this bug be dependent on the wordpress setup in use?

Can't provide a reproduction, but give you more information.
In all cases, links to media Items are consistently saved in the wordpress post content like this <p>Vollständiger Call for Papers (<a href="https://domain.org/wp-content/uploads/2020/11/filename.pdf">Link</a>)</p>

The inconsistent behaviour of gatsby-source-wordpress however is as written above.
Any hints on how I could fix this?

This was fixed in a later version of this plugin - please comment here or re-open this issue if upgrading doesn't fix the problem for you. Apologies for the very delayed response/resolution here