Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Conversation

t3chguy
Copy link
Member

@t3chguy t3chguy commented Mar 22, 2020

No description provided.

@t3chguy t3chguy requested a review from turt2live March 22, 2020 02:15
Copy link
Member

@turt2live turt2live left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should always be adding the slash dynamically, which is something the previous code did

@t3chguy
Copy link
Member Author

t3chguy commented Mar 22, 2020

its what caused me to get a riot embedded instead of a Jitsi so I entirely disagree.

http://riot.im/develop/index.html? is a valid (albeit bizarre) way to view Riot, if you add a trailing slash to that it won't work.
However if you try and go to https://riot.im/develop you will observe that the webserver adds the trailing slash for you because its a directory.

I don't think writing a heuristic to detect "indexy" things is sane.

@turt2live
Copy link
Member

we also can't guarantee that window.location will have a slash...

@t3chguy
Copy link
Member Author

t3chguy commented Mar 22, 2020

we also can't guarantee that window.location will have a slash...

the right thing to do, is to follow browser mechanisms and use relative paths which is what the above matches.

@turt2live
Copy link
Member

No, it's not:

new URL("jitsi.html#stuff", "https://riot.im/develop") URL {href: "https://riot.im/jitsi.html#stuff", origin: "https://riot.im", protocol: "https:", username: "", password: "", …} 
@t3chguy
Copy link
Member Author

t3chguy commented Mar 22, 2020

Right. the above example is expected. but in this case it is not possible to write code which works for both

riot.im/develop
&
riot.im/develop/index.html

and we have no way of knowing if someone is just hosting their riot in a folder called index.html or if its a file so we should rely on relative URLs as other apps would break if they were misconfigured too as they wouldn't be able to find their assets without manual base url configuration.

Copy link
Member

@turt2live turt2live left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

turns out that window.location will always have a trailing slash when needed due to an undocumented feature of major browsers :(

@t3chguy t3chguy merged commit 2df0680 into develop Mar 22, 2020
@t3chguy t3chguy deleted the t3chguy/patch-1 branch April 27, 2020 17:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants