mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 14:56:19 -04:00
uppercase constant
This commit is contained in:
parent
afb9fd8408
commit
c19fe5cffa
1 changed files with 2 additions and 2 deletions
|
@ -65,10 +65,10 @@ class URLEncode extends Operation {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
encodeAllSpecialChars (str) {
|
encodeAllSpecialChars (str) {
|
||||||
const specialChars = "!#'()*-._~";
|
const SPECIAL_CHARS = "!#'()*-._~";
|
||||||
let encoded = "";
|
let encoded = "";
|
||||||
for (const char of str) {
|
for (const char of str) {
|
||||||
if (encodeURIComponent(char) === char && specialChars.includes(char)) {
|
if (encodeURIComponent(char) === char && SPECIAL_CHARS.includes(char)) {
|
||||||
encoded += "%" + this.frontPad(char.charCodeAt(0).toString(16).toUpperCase(), 2, "0");
|
encoded += "%" + this.frontPad(char.charCodeAt(0).toString(16).toUpperCase(), 2, "0");
|
||||||
} else {
|
} else {
|
||||||
encoded += encodeURIComponent(char);
|
encoded += encodeURIComponent(char);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue