Embedding Discourse comments in another site does not support case-sensitive URLs.
Using the standard embedding instructions provided in the admin interface, under Customize > Embedding, the host site provides the discourseEmbedURL value. If providing case-sensitive URL paths, such as http://site.com/AAA and http://site.com/aaa, the same comment thread will be embedded in both pages.
The root of this issue is in the normalizeURL function in Discourse’s public/javascript/embed.js file, which currently reads:
function normalizeUrl(url) {
return url.toLowerCase().replace(/^https?(\:\/\/)?/, '');
}
I would argue there is no reason to lower case the URL provided. The URL is provided by the host application, which should be able to make decisions about what is considered a unique URL. Removing toLowerCase() should be a non-breaking change that will allow case-sensitive URLs to be supported properly.
function normalizeUrl(url) {
return url.replace(/^https?(\:\/\/)?/, '');
}
Yes, it is. I have case-sensitive identifiers in the URLs in the action directory site I run for my app (example).
In retrospect, I should probably not have used case-senstive IDs, but that’s water under the bridge - would be hard to change now. Used a generator similar to those used for URLs shorteners like bitly (which are also case-sensitive).
I’d agree this could be a problem if it were a case that the user had to enter these URLs, but since the embedding is done programmatically, it doesn’t seem necessary to downcast.
Os padrões do W3 afirmam que, exceto para nomes de máquinas, URLs devem ser sensíveis a maiúsculas e minúsculas. Embora isso possa ser confuso, acredito que faz mais sentido seguir os padrões existentes.
É. Geralmente sou um purista quando se trata de nomes de arquivos sensíveis a maiúsculas e minúsculas. Estou indignado com sistemas operacionais que, de forma preguiçosa, ignoram a diferença entre maiúsculas e minúsculas nos nomes de arquivos e fazem as pessoas fazerem coisas estúpidas há quase três décadas (ou pelo menos desde cerca de 1995, quando comecei a desenvolver aplicações web e o Mac idiota tinha um sistema de arquivos insensível a maiúsculas e minúsculas). Não tenho certeza do que aconteceu. Eram 9h43, então deveria estar totalmente acordado e até ter tomado café. Talvez alguém tenha hackeado minha conta e escrito isso?
Mas agora já passou muito tempo para eu apagar a postagem e remover o registro disso.
Parece que esta é uma daquelas situações em que um usuário teve problemas anteriormente porque era insensível a maiúsculas e minúsculas, e agora é o oposto! Que mundo divertido é o desenvolvimento de software!
@techAPJ, detesto ter que fazer isso, mas você poderia reverter a parte insensível a maiúsculas e minúsculas? Tecnicamente é permitido e acho que devemos nos ater aos padrões agora.