Skip to content
Myr

fix(client): prevent URL corruption when replaceUrlParam contains $ replacement tokens (#5227)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* fix(client): prevent URL corruption when replaceUrlParam contains $ replacement tokens * ci: apply automated fixes ---------

authored by ADITYA KUMAR JHA · committed by GitHub · parent 41bdc42 · Browse files · 2 files+16 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

Diff stats

2 files+16 added−1 removed

  • tests:+15 added−0 removed
  • other:+1 added−1 removed

2 files+16 added−1 removed

modified:src/client/utils.test.ts+15 added
72 unmodified lines
73 }74 const replacedUrl = replaceUrlParam(url, params)75 expect(replacedUrl).toBe('http://localhost/2/1')76 })7778 it('Should replace correctly when parameter value contains $ characters', () => {79 expect(replaceUrlParam('http://localhost/items/:id', { id: 'item$&' })).toBe(80 'http://localhost/items/item$&'81 )82 expect(replaceUrlParam('http://localhost/items/:id', { id: '$100' })).toBe(83 'http://localhost/items/$100'84 )85 expect(replaceUrlParam('http://localhost/users/:id', { id: 'test$`' })).toBe(86 'http://localhost/users/test$`'87 )88 expect(replaceUrlParam('http://localhost/users/:id/posts', { id: "test$'" })).toBe(89 "http://localhost/users/test$'/posts"90 )91 })92})9394describe('buildSearchParams', () => {95 it('Should build URLSearchParams correctly', () => {
288 unmodified lines
modified:src/client/utils.ts+1 added-1 removed