Google Maps embeded links sometimes work, sometimes don't (onebox 404)

AI-generated summary

A user reported inconsistent Google Maps onebox embedding, where some links return a 404 error while others work. awesomerobot identified that the issue is related to the zoom level in the URL, specifically when it includes decimal values (e.g., 15.5z), which the current regex fails to match. Falco confirmed the issue lies in the regex pattern in the Google Maps onebox engine. loic fixed the issue with a pull request, and zogstrip confirmed that the fix resolved the problem, with all Google Maps links now working correctly.

I’m facing a weird behavior with Google Maps link.

Sometimes, they properly embed, and sometimes the onebox request returns a 404. I couldn’t find a way to reproduce the issue consistently, but it’s very often. Just try to paste links, move the google maps camera or cropping, try again, etc…

I first thought about a rate limit, but it’s not. The links that work and those that don’t are the same here or on my forum. Example:

Does anyone have an idea about where this issue comes from? Google side? Discourse side? Should it be moved to Contribute > Bug?

5 Likes

This is kind of weird, I just happened to notice the pattern… but I think it has something to do with the zoom level in the link?

:x: 15.5z

:white_check_mark: 15z

:x: 16.75z

:white_check_mark: 17z

An entirely different location…

:x: 15.38z

:white_check_mark: 15z

My guess is that it’s a Google Maps onebox engine issue on our end?

8 Likes

Nice sleuthing @awesomerobot ! :man_detective:

Looks like our regex for zoom level doesn’t allow dots here:

Quite an easy fix.

9 Likes

What a catch :smiley:

Thanks for figuring it out!

2 Likes

@loic can you have a quick look at this one?

1 Like

Sure, I’ll take a look :slight_smile:

Fixed here:
https://github.com/discourse/discourse/pull/20497

6 Likes

Rebuilding @awesomerobot’s post and all the Google Maps links are now working :clap:

Closing this.

6 Likes