Embed URL Inconsistencies in Discourse

Continuing the discussion from “Show Full Post” button doesn’t work in subfolder installations:

@angus mentioned that Discourse is removing the trailing slash from the end of the Embed URL, to avoid some conflicts.

So now https://domain.com/path-to-url/ is saved as https://domain.com/path-to-url.

In my opinion, this leads to more inconsistencies. If i try to check the API, to get 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:

mobilon@Thiagos-MacBook-Pro ~ % curl 'https://tecnoblog.net/comunidade/embed/info?embed_url=https://tecnoblog.net/noticias/anatel-e-receita-apreendem-quase-meio-milhao-de-produtos-em-santa-catarina/' -H 'API-KEY: <API KEY>' -H 'API-USERNAME: <USERNAME>'

<!DOCTYPE html>

<html lang="pt-BR">

<head>

  <meta charset="utf-8">

  <title>Página não encontrada - Tecnoblog Comunidade</title>

mobilon@Thiagos-MacBook-Pro ~ % curl 'https://tecnoblog.net/comunidade/embed/info?embed_url=https://tecnoblog.net/noticias/anatel-e-receita-apreendem-quase-meio-milhao-de-produtos-em-santa-catarina' -H 'API-KEY: <API KEY>' -H 'API-USERNAME: <USERNAME>' 

{"topic_id":157645,"post_id":484103,"topic_slug":"anatel-e-receita-apreendem-quase-meio-milhao-de-produtos-em-santa-catarina-tecnoblog","comment_count":15}%     

To be able to find the correct topic, i would need to use str replace in wordpress, to remove the trailing slash of the permalink, before checking the api. It makes no sense, since the canonical URL actually has the trailing slash…

In other words, it’s like Discourse is normalizing the permalink to a URL that doesn’t exist.