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.
Стандарты W3 гласят, что за исключением имен машин, URL-адреса чувствительны к регистру. Хотя это может быть запутанным, я считаю, что наиболее логично придерживаться существующих стандартов.
Да. Я в целом принципиален, когда речь заходит о регистрозависимых именах файлов. Уже почти три десятилетия (или, по крайней мере, с 1995 года, когда я начал разрабатывать веб-приложения, а глупый Mac имел регистронезависимую файловую систему) я возмущаюсь операционными системами, которые по лени игнорируют регистр в именах файлов и заставляют людей совершать глупые поступки. Не знаю, что случилось. Было 9:43 утра, так что я должен был быть полностью бодрым и даже уже выпить кофе. Может, кто-то взломал мой аккаунт и написал это?
Но теперь прошло слишком много времени, чтобы я мог удалить пост и стереть запись об этом.
Похоже, это один из тех случаев, когда у одного пользователя ранее возникали проблемы из-за того, что система не учитывала регистр, а теперь всё наоборот! Какой забавный мир разработки программного обеспечения!
@techAPJ Не хочется этого делать, но не могли бы вы отменить изменение, связанное с игнорированием регистра? Технически это разрешено, и я считаю, что нам стоит придерживаться стандартов.