Einbetten von Kommentaren auf anderen Seiten unterstützt keine URLs mit Groß-/Kleinschreibung

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?(\:\/\/)?/, '');
}

Thoughts?

3 „Gefällt mir“

I think that it’s confusing to people to have URLs that are case sensitive so it makes sense to downcase them.

1 „Gefällt mir“

No, one should never assume that URL paths are case insensitive.

I suspect this was done because we had people having trouble embedding without the toLowerCase, @techAPJ?

@agiletortoise I presume you are raising this because this is actually causing a problem for you somewhere?

5 „Gefällt mir“

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.

4 „Gefällt mir“

eh, URL paths MUST be treated as case sensitive by external systems… just like email usernames, but that’s a story for another time

5 „Gefällt mir“

Die W3-Standards besagen, dass URLs – mit Ausnahme von Maschinennamen – groß- und kleinschreibungsabhängig sind. Auch wenn dies verwirrend sein mag, halte ich es für am sinnvollsten, sich an die bestehenden Standards zu halten.

1 „Gefällt mir“

Ja. Ich bin generell ein Verfechter von dateinamenssensiblen Systemen. Ich bin seit fast drei Jahrzehnten empört über Betriebssysteme, die fahrlässig die Groß-/Kleinschreibung in Dateinamen ignorieren und Menschen dazu bringen, dumme Fehler zu machen (zumindest seit etwa 1995, als ich mit der Entwicklung von Webanwendungen begann und das dumme Mac-System ein dateinamensunempfindliches Dateisystem hatte). Ich bin mir nicht sicher, was passiert ist. Es war 9:43 Uhr morgens, also hätte ich hellwach sein und sogar Kaffee getrunken haben müssen. Vielleicht hat jemand mein Konto gehackt und das geschrieben? :wink:

Aber jetzt ist es zu lange her, als dass ich den Beitrag löschen könnte, um diese Aufzeichnung zu entfernen.

Es sieht so aus, als wäre dies eine jener Situationen, in denen ein Benutzer zuvor Probleme hatte, weil es nicht case-sensitiv war, und jetzt ist es genau umgekehrt! Was für eine lustige Welt die Softwareentwicklung ist!

@techAPJ Ich möchte das ungern sagen, aber könntest du den Teil zur Case-Insensitivität bitte rückgängig machen? Es ist technisch erlaubt, und ich denke, wir sollten uns jetzt an die Standards halten.

9 „Gefällt mir“

Okay, ich habe diesen Commit rückgängig gemacht.

8 „Gefällt mir“