mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-03 14:34:40 +00:00
fix(core): strip trailing slashes when normalizing auth and MCP resource URLs (#506)
* fix(core): strip trailing slashes when normalizing auth and MCP resource URLs * docs: document BETTER_AUTH_URL in README and quickstart guides * docs: prioritize AWS_ENDPOINT_URL_S3 and clarify applicability to local storage * docs: refine AWS_ENDPOINT_URL_S3 guidance for local storage deployments
This commit is contained in:
@@ -303,4 +303,26 @@ describe('AuthService Password Reset', () => {
|
||||
expect(resetResA.success).toBe(true)
|
||||
expect(resetResB.success).toBe(true)
|
||||
})
|
||||
|
||||
it('generates reset link cleanly preserving path prefix and without double slashes when BETTER_AUTH_URL has trailing slashes', async () => {
|
||||
const originalEnv = process.env.BETTER_AUTH_URL
|
||||
try {
|
||||
process.env.BETTER_AUTH_URL = 'https://staging.shumai.one/shumai///'
|
||||
const email = `slash-test-${Date.now()}@example.com`
|
||||
await auth.api.signUpEmail({
|
||||
headers: new Headers(),
|
||||
body: { email, password: 'password123', name: 'Slash User' },
|
||||
})
|
||||
|
||||
const link = await authService.generatePasswordResetLink(email)
|
||||
expect(link).toMatch(/^https:\/\/staging\.shumai\.one\/shumai\/reset-password\?token=/)
|
||||
expect(link).not.toContain('//reset-password')
|
||||
} finally {
|
||||
if (originalEnv !== undefined) {
|
||||
process.env.BETTER_AUTH_URL = originalEnv
|
||||
} else {
|
||||
delete process.env.BETTER_AUTH_URL
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user