mirror of
https://github.com/Kong/insomnia
synced 2024-11-07 22:30:15 +00:00
Fix dollar not correctly handled on URI (#2862)
Co-authored-by: Dimitri Mitropoulos <dimitrimitropoulos@gmail.com> Co-authored-by: Opender Singh <opender.singh@konghq.com>
This commit is contained in:
parent
3362f30de6
commit
b0919ef7a4
@ -178,13 +178,13 @@ describe('querystring', () => {
|
||||
});
|
||||
|
||||
it('leaves already encoded pathname', () => {
|
||||
const url = smartEncodeUrl('https://google.com/foo%20bar%20baz/100%25/foo');
|
||||
expect(url).toBe('https://google.com/foo%20bar%20baz/100%25/foo');
|
||||
const url = smartEncodeUrl('https://google.com/foo%20bar%20baz/100%25/foo/%24');
|
||||
expect(url).toBe('https://google.com/foo%20bar%20baz/100%25/foo/%24');
|
||||
});
|
||||
|
||||
it('encodes querystring', () => {
|
||||
const url = smartEncodeUrl('https://google.com?s=foo bar 100%&hi');
|
||||
expect(url).toBe('https://google.com/?s=foo%20bar%20100%25&hi');
|
||||
const url = smartEncodeUrl('https://google.com?s=foo bar 100%&hi$');
|
||||
expect(url).toBe('https://google.com/?s=foo%20bar%20100%25&hi%24');
|
||||
});
|
||||
|
||||
it('encodes querystring with mixed spaces', () => {
|
||||
@ -205,6 +205,14 @@ describe('querystring', () => {
|
||||
// Encoded should skip encoded versions of @ ; ,
|
||||
const url2 = smartEncodeUrl('https://google.com/%40%3B%2C%26%5E');
|
||||
expect(url2).toBe('https://google.com/%40%3B%2C%26%5E');
|
||||
|
||||
// Encoded should skip raw versions of $
|
||||
const url3 = smartEncodeUrl('https://google.com/$myservice');
|
||||
expect(url3).toBe('https://google.com/$myservice');
|
||||
|
||||
// Encoded should skip encoded versions of $
|
||||
const url4 = smartEncodeUrl('https://google.com/%24myservice');
|
||||
expect(url4).toBe('https://google.com/%24myservice');
|
||||
});
|
||||
|
||||
it('leaves already encoded characters alone', () => {
|
||||
|
@ -2,7 +2,15 @@ import { parse as urlParse, format as urlFormat } from 'url';
|
||||
import { setDefaultProtocol } from './protocol';
|
||||
|
||||
const ESCAPE_REGEX_MATCH = /[-[\]/{}()*+?.\\^$|]/g;
|
||||
const URL_PATH_CHARACTER_WHITELIST = '+,;@=:';
|
||||
|
||||
/** see list of allowed characters https://datatracker.ietf.org/doc/html/rfc3986#section-2.2 */
|
||||
const RFC_3986_GENERAL_DELIMITERS = ':@'; // (unintentionally?) missing: /?#[]
|
||||
|
||||
/** see list of allowed characters https://datatracker.ietf.org/doc/html/rfc3986#section-2.2 */
|
||||
const RFC_3986_SUB_DELIMITERS = '$+,;='; // (unintentionally?) missing: !&'()*
|
||||
|
||||
/** see list of allowed characters https://datatracker.ietf.org/doc/html/rfc3986#section-2.2 */
|
||||
const URL_PATH_CHARACTER_WHITELIST = `${RFC_3986_GENERAL_DELIMITERS}${RFC_3986_SUB_DELIMITERS}`;
|
||||
|
||||
export const getJoiner = (url: string) => {
|
||||
url = url || '';
|
||||
|
Loading…
Reference in New Issue
Block a user