Fix broken photo links in comments and journal pages

It has been pointed out that i have quite a few broken links in comments and journal page. All appear to be due to the move of the photos from the static pages to amazon: so -
https://static.inaturalist.org/photos/123
has become
https://inaturalist-open-data.s3.amazonaws.com/photos/123

  1. Is it not possible to redirect the old (broken) links to the new - instead of generating a 403 ERROR (## The request could not be satisfied.) and displaying the “alt” text

  2. Is it possible to search for and get a dump of broken links, so assuming that “1” is not possible, at least I can find all my broken links and manually replace ‘static.inaturalist.org’ with ‘inaturalist-open-data.s3.amazonaws.com’ to activate them.
    But what will happen next time the pictures are moved to a new server?

Ta
Tony

They seem to map directly so a server side redirect would be very easy to implement (but they don’t implement easy feature requests unless lots of people vote for them).

[Another option would be to remap the DNS for static.inaturalist.org but I’m not sure what Amazon would support there. I tried changing my hosts file but that doesn’t work because of https of course.]

Great idea, this issue has been pretty irritating…

This seems also to be affecting the species pages:
so https://www.inaturalist.org/taxa/580375-Askidiosperma-andreaeanum
has two pictures - both of which are not displaying:
https://static.inaturalist.org/photos/21055419/small.jpg?1531140473
https://www.inaturalist.org/photos/21055419

I will add another:
Oh: dear - the other two have now vanished.

1 Like

I just noticed that too - some species’ images are broken (still pointing to static.) while most are working - so that would really be a bug report? Frustrating.

1 Like

the bug report for taxon photos already exists: https://forum.inaturalist.org/t/representative-pictures-not-showing-on-all-species-pages/25401.

it doesn’t include the item about journal pages though. so i’m not sure how the folks who need to know would prefer it organized, but this could be consolidated with that bug report, or maybe a separate bug report could be made for the journal issue.

add to https://forum.inaturalist.org/t/representative-pictures-not-showing-on-all-species-pages/25401

guess we can close this then?

  1. Is it not possible to redirect the old (broken) links to the new - instead of generating a 403 ERROR (## The request could not be satisfied.) and displaying the “alt” text

It is unfortunately not possible. Some images have been moved, others have not, and there isn’t any way to apply logic to redirect only the ones that have.

  1. Is it possible to search for and get a dump of broken links, so assuming that “1” is not possible, at least I can find all my broken links and manually replace ‘static.inaturalist.org’ with ‘inaturalist-open-data.s3.amazonaws.com ’ to activate them.

In short - this kind of search is not possible. You can use the “Description / Tags” advanced search filter for searching observation bodies, but not for comments.

Going forward, I’d recommend linking to an observation or photo page URL rather than embedding an image URL. Page URLs are also not guaranteed to work 100% of the time (for example we have had a partner change domains leading to lots of broken links that required manual fixing), but they will be more stable than photos, whose URLs will change depending on the license of the photo.

But what will happen next time the pictures are moved to a new server?

While we try to maintain consistent URLs as much as possible, keeping things in the same place, forever accessible by the same URLs is not something we promise. If you embed URLs of photos, there is no guarantee they will always resolve, if the photos is hosted by iNaturalist or otherwise. As recommended above, I’d link to a details page instead of embedding an image.

2 Likes

Oh well, I spent a long time making my journal posts (like this one) look nice but probably won’t write make any more journal entries as nobody reads them anyway. Making journal entries with links to observations instead seems like the primitive early days (literally) of HTML before images could be embedded.