[PR #1182] [MERGED] fix: remove trailing slashes from base url #20576

Closed
opened 2026-04-15 19:47:25 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/1182
Author: @snelusha
Created: 1/10/2025
Status: Merged
Merged: 1/11/2025
Merged by: @Bekacru

Base: mainHead: fix/trailing-slash


📝 Commits (1)

  • 5f1f1f5 fix: remove trailing slashes from base url

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 packages/better-auth/src/utils/url.ts (+1 -1)

📄 Description

This pull request includes an important change to the withPath function in the packages/better-auth/src/utils/url.ts file. The change ensures that the URL does not end with multiple slashes before appending the path.

  • packages/better-auth/src/utils/url.ts: Modified the withPath function to remove trailing slashes from the URL before appending the path.
  • I updated the packages/better-auth/src/init.test.ts file by adding test cases for baseUrl with trailing slashes and ran the tests to ensure the changes work as expected.
image

Closes #1156


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/1182 **Author:** [@snelusha](https://github.com/snelusha) **Created:** 1/10/2025 **Status:** ✅ Merged **Merged:** 1/11/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `main` ← **Head:** `fix/trailing-slash` --- ### 📝 Commits (1) - [`5f1f1f5`](https://github.com/better-auth/better-auth/commit/5f1f1f5a2334cdf32ca13f4abd19481273be52c1) fix: remove trailing slashes from base url ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/utils/url.ts` (+1 -1) </details> ### 📄 Description This pull request includes an important change to the `withPath` function in the `packages/better-auth/src/utils/url.ts` file. The change ensures that the URL does not end with multiple slashes before appending the path. * [`packages/better-auth/src/utils/url.ts`](diffhunk://#diff-ee268e99ecf5bb4eff434ec4334aa0e0fa636ab90853abf1cb584f48a74c3776L21-R21): Modified the `withPath` function to remove trailing slashes from the URL before appending the path. * I updated the `packages/better-auth/src/init.test.ts` file by adding test cases for baseUrl with trailing slashes and ran the tests to ensure the changes work as expected. <img width="798" alt="image" src="https://github.com/user-attachments/assets/d8e9d4dc-9559-4be4-8b80-69f798a6c96f" /> Closes #1156 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-15 19:47:25 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#20576