discourse(prod)> TopicEmbed.find_by(topic_id: 157441).as_json
Serializing ActiveRecord models (TopicEmbed) without specifying fields is not allowed. Use a Serializer, or pass the :only option to #serializable_hash. More info: ``https://meta.discourse.org/t/-/314495
=>
{“id”=>56685,
“topic_id”=>157441,
“post_id”=>483289,
“embed_url”=>
“``https://tecnoblog.net/noticias/paramount-oferece-us-108-bilhoes-em-dinheiro-para-tomar-warner-da-netflix”``,
“content_sha1”=>nil,
“created_at”=>“2025-12-08T17:54:07.585Z”,
“updated_at”=>“2025-12-09T18:04:33.539Z”,
“deleted_at”=>nil,
“deleted_by_id”=>nil,
“embed_content_cache”=>“”}
discourse(prod)>
Could you just run the same command again, but this time:
./launcher enter app
rails c
TopicEmbed.find_by(topic_id: 157441).embed_url
If what you shared is indeed the value of embed_url in your db, then that is the issue, and I’ll make a small PR to discourse/discourse to handle edge cases like this where the embed_url has ended up in a malformed state.
About these backticks at the beginning and end of the url, I think it was just an error trying to format the text here in the topic, using the code button.
So the entire issue here is because the above PR started removing trailing slashes from TopicEmbed in January this year? I feel conflicted about this change. I’d prefer we respect what the admin sends us to be honest.
The reason we made that change is because there was an inconsistency between how WP Discourse embeds and javascript embeds worked. Javascript embeds have always normalised the url. WP Discourse embeds came in through a different route and weren’t normalising the url (until we made the change). That led to some other inconsistencies.
One other issue is that, when i run a curl to the API, searching for the topic ID of an embed URL, i can’t find it because of the trailing slash. Discourse returns a 404 page.
But if i remove the trailing slash, it returns the value:
To make it work, i would need to make a str replace in wordpress, to remove the trailing slash of the permalink, before checking. But this makes no sense, the canonical URL has the trailing slash…
In practice, Discourse is normalizing the permalink to a URL that doesn’t exist… the normalized version should be the one with a trailing slash.
But i’m still concerned about the URLs without the trailing slash, for the reasons mentioned in my previous post. Should i open a new topic about this @angus?
Sure! It won’t affect the “Full Post” feature as we can now follow redirects in sites in the same domain as the forum, but you can follow up in a new topic for other concerns.