mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 14:56:19 -04:00
Fix lint issues
This commit is contained in:
parent
e3d6483ab5
commit
43fdc70d06
1 changed files with 13 additions and 6 deletions
|
@ -34,20 +34,27 @@ class ExtractURI extends Operation {
|
||||||
const uri = new URL(input);
|
const uri = new URL(input);
|
||||||
const pieces = {};
|
const pieces = {};
|
||||||
// Straight copy some attributes
|
// Straight copy some attributes
|
||||||
['protocol', 'hostname', 'port', 'username', 'password', 'pathname', 'hash'
|
[
|
||||||
].forEach((name) => {
|
"hash",
|
||||||
if (uri[name]) pieces[name] = uri[name];
|
"hostname",
|
||||||
|
"password",
|
||||||
|
"pathname",
|
||||||
|
"port",
|
||||||
|
"protocol",
|
||||||
|
"username"
|
||||||
|
].forEach((name) => {
|
||||||
|
if (uri[name]) pieces[name] = uri[name];
|
||||||
});
|
});
|
||||||
// Now handle query params
|
// Now handle query params
|
||||||
const params = uri.searchParams;
|
const params = uri.searchParams;
|
||||||
if (params.size) {
|
if (params.size) {
|
||||||
pieces['query'] = {};
|
pieces.query = {};
|
||||||
for (const name of params.keys()) {
|
for (const name of params.keys()) {
|
||||||
const values = params.getAll(name);
|
const values = params.getAll(name);
|
||||||
if (values.length > 1) {
|
if (values.length > 1) {
|
||||||
pieces['query'][name] = values;
|
pieces.query[name] = values;
|
||||||
} else {
|
} else {
|
||||||
pieces['query'][name] = values[0];
|
pieces.query[name] = values[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue