kaneo (minimalist kanban) fork to experiment adding a tangled integration github.com/usekaneo/kaneo
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(libs): strip trailing slash before appending /api in resolveApiBaseUrl

- Avoid double slashes when VITE_API_URL ends with /.
- Add regression tests for trailing-slash inputs.

Tin 6edf7cfa fedd40a0

+11 -1
+9
packages/libs/src/api-url.test.ts
··· 14 14 "http://localhost:1337/api", 15 15 ); 16 16 }); 17 + 18 + it("strips trailing slashes before appending /api", () => { 19 + expect(resolveApiBaseUrl("http://localhost:1337/")).toBe( 20 + "http://localhost:1337/api", 21 + ); 22 + expect(resolveApiBaseUrl("http://localhost:1337/api/")).toBe( 23 + "http://localhost:1337/api", 24 + ); 25 + }); 17 26 });
+2 -1
packages/libs/src/api-url.ts
··· 3 3 * If the value already ends with `/api`, it is returned as-is; otherwise `/api` is appended. 4 4 */ 5 5 export function resolveApiBaseUrl(viteApiUrl: string | undefined): string { 6 - const baseUrl = viteApiUrl || "http://localhost:1337"; 6 + const raw = viteApiUrl || "http://localhost:1337"; 7 + const baseUrl = raw.replace(/\/+$/, ""); 7 8 return baseUrl.endsWith("/api") ? baseUrl : `${baseUrl}/api`; 8 9 }