matrix-public-archive/shared
Eric Eastwood b7c00c31c1
Fix URL being duplicated in query param (#110)
Fix https://github.com/matrix-org/matrix-public-archive/pull/104#discussion_r1004023030

### What was the problem?

We were previously seeing this behavior with the old code:

```
Before: http://localhost:3050/!xxx:server/date/2022/09/20?via=my.synapse.server
replaceUrlSilently(url='http://localhost:3050/!xxx:server/date/2022/09/20')`
After: http://localhost:3050/!xxx:server/date/2022/09/20?via=my.synapse.serverhttp://localhost:3050/!xxx:server/date/2022/07/29
```

Because `replacingUrl` was evaluating to `replacingUrl = '?via=my.synapse.serverhttp://192.168.1.151:3050/!HBehERstyQBxyJDLfR:my.synapse.server/date/2022/07/29'` which is relative and was appended to the current URL.


### Solution

Now with the new code, we more clearly handle the 3 cases:

 - Normal Hydrogen `#/foo-bar` hash routing on the end of the URL
 - When `url=''` and we just need clear the Hydrogen hash route and maintain the current path and query parameters
 - An absolute URL which we can completely replace the page URL with
2022-10-25 01:59:23 -05:00
..
lib Fix URL being duplicated in query param (#110) 2022-10-25 01:59:23 -05:00
viewmodels Link rooms with `?via` query paramter from room directory landing page (#104) 2022-10-21 16:06:11 -05:00
views Fixup room directory fetch error message (#108) 2022-10-24 15:49:23 -05:00
.eslintrc.json Stop restarting server when the client bundle updates 2022-02-15 17:30:30 -06:00
hydrogen-vm-render-script.js Add homeserver selector to room directory landing page (#87) 2022-10-20 02:06:43 -05:00
room-directory-vm-render-script.js Page-load with the correct homeserver selected (#98) 2022-10-21 02:09:26 -05:00