mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
querystring: convert to using internal/errors
PR-URL: https://github.com/nodejs/node/pull/15565 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
This commit is contained in:
parent
1c0772444c
commit
9788e96836
5 changed files with 33 additions and 12 deletions
|
@ -24,6 +24,7 @@
|
|||
'use strict';
|
||||
|
||||
const { Buffer } = require('buffer');
|
||||
const errors = require('internal/errors');
|
||||
const {
|
||||
hexTable,
|
||||
isHexTable
|
||||
|
@ -174,11 +175,12 @@ function qsEscape(str) {
|
|||
}
|
||||
// Surrogate pair
|
||||
++i;
|
||||
var c2;
|
||||
if (i < str.length)
|
||||
c2 = str.charCodeAt(i) & 0x3FF;
|
||||
else
|
||||
throw new URIError('URI malformed');
|
||||
|
||||
if (i >= str.length)
|
||||
throw new errors.URIError('ERR_INVALID_URI');
|
||||
|
||||
var c2 = str.charCodeAt(i) & 0x3FF;
|
||||
|
||||
lastPos = i + 1;
|
||||
c = 0x10000 + (((c & 0x3FF) << 10) | c2);
|
||||
out += hexTable[0xF0 | (c >> 18)] +
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue