Merge pull request #135 from ExperiBass/trim-trailing-slash

remove trailing slashes from instance url
This commit is contained in:
SleeplessOne1917 2023-06-14 23:57:56 +00:00 committed by GitHub
commit 80bdd21eae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -155,7 +155,7 @@ export class LemmyHttp {
* @param headers optional headers. Should contain `x-real-ip` and `x-forwarded-for` .
*/
constructor(baseUrl: string, headers?: { [key: string]: string }) {
this.#apiUrl = `${baseUrl}/api/${VERSION}`;
this.#apiUrl = `${baseUrl.replace(/\/+$/, "")}/api/${VERSION}`;
this.#pictrsUrl = `${baseUrl}/pictrs/image`;
if (headers) {