mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 06:55:08 -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 pieces = {};
|
||||
// Straight copy some attributes
|
||||
['protocol', 'hostname', 'port', 'username', 'password', 'pathname', 'hash'
|
||||
].forEach((name) => {
|
||||
if (uri[name]) pieces[name] = uri[name];
|
||||
[
|
||||
"hash",
|
||||
"hostname",
|
||||
"password",
|
||||
"pathname",
|
||||
"port",
|
||||
"protocol",
|
||||
"username"
|
||||
].forEach((name) => {
|
||||
if (uri[name]) pieces[name] = uri[name];
|
||||
});
|
||||
// Now handle query params
|
||||
const params = uri.searchParams;
|
||||
if (params.size) {
|
||||
pieces['query'] = {};
|
||||
pieces.query = {};
|
||||
for (const name of params.keys()) {
|
||||
const values = params.getAll(name);
|
||||
if (values.length > 1) {
|
||||
pieces['query'][name] = values;
|
||||
pieces.query[name] = values;
|
||||
} else {
|
||||
pieces['query'][name] = values[0];
|
||||
pieces.query[name] = values[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue