icecat: add release icecat-140.8.0-2gnu1 for ecne
This commit is contained in:
parent
450538011a
commit
8eb1f1732f
616 changed files with 39955 additions and 33937 deletions
|
|
@ -124,30 +124,34 @@ class RequestPanel extends Component {
|
|||
}
|
||||
|
||||
/**
|
||||
* Mapping array to dict for TreeView usage.
|
||||
* Since TreeView only support Object(dict) format.
|
||||
* This function also deal with duplicate key case
|
||||
* (for multiple selection and query params with same keys)
|
||||
* This maps an array to a dictionary for TreeView usage,
|
||||
* sincs the treeView only supports the Object(dict) format.
|
||||
*
|
||||
* This function is not sorting result properties since it can
|
||||
* results in unexpected order of params. See bug 1469533
|
||||
* This function also deals with the duplicate key scenario
|
||||
* (i.e multiple selections and query params with same keys)
|
||||
*
|
||||
* @param {Object[]} arr - key-value pair array or form params
|
||||
* @returns {Object} Rep compatible object
|
||||
* Note: This is not sorting the result properties since it can
|
||||
* result in an unexpected order of parameters. See bug 1469533
|
||||
*
|
||||
* @param {object[]} arrOfKeyValuePairs - An array of key-value pairs or form params.
|
||||
* @param {string} arrOfKeyValuePairs[].name
|
||||
* @param {string|Array} arrOfKeyValuePairs[].value
|
||||
*
|
||||
* @returns {object} Rep compatible object
|
||||
*/
|
||||
getProperties(arr) {
|
||||
return arr.reduce((map, obj) => {
|
||||
const value = map[obj.name];
|
||||
if (value || value === "") {
|
||||
if (typeof value !== "object") {
|
||||
map[obj.name] = [value];
|
||||
getProperties(arrOfKeyValuePairs) {
|
||||
return arrOfKeyValuePairs.reduce((dict, { name, value }) => {
|
||||
if (name in dict) {
|
||||
const dictValue = dict[name];
|
||||
if (!Array.isArray(dictValue)) {
|
||||
dict[name] = [dictValue];
|
||||
}
|
||||
map[obj.name].push(obj.value);
|
||||
dict[name].push(value);
|
||||
} else {
|
||||
map[obj.name] = obj.value;
|
||||
dict[name] = value;
|
||||
}
|
||||
return map;
|
||||
}, {});
|
||||
return dict;
|
||||
}, Object.create(null));
|
||||
}
|
||||
|
||||
toggleRawRequestPayload() {
|
||||
|
|
@ -205,10 +209,9 @@ class RequestPanel extends Component {
|
|||
|
||||
// Form Data section
|
||||
if (formDataSections && formDataSections.length) {
|
||||
const sections = formDataSections.filter(str => /\S/.test(str)).join("&");
|
||||
component = PropertiesView;
|
||||
componentProps = {
|
||||
object: this.getProperties(parseFormData(sections)),
|
||||
object: this.getProperties(parseFormData(formDataSections)),
|
||||
filterText,
|
||||
targetSearchResult,
|
||||
defaultSelectFirstNode: false,
|
||||
|
|
|
|||
|
|
@ -83,7 +83,6 @@ async function getFormDataSections(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return formDataSections;
|
||||
}
|
||||
|
||||
|
|
@ -418,28 +417,29 @@ function parseQueryString(query) {
|
|||
/**
|
||||
* Parse a string of formdata sections into its components
|
||||
*
|
||||
* @param {string} sections - sections of formdata joined by &
|
||||
* @return {array} array of formdata params { name, value }
|
||||
* @param {Array<string>} sections Array of sections of formdata
|
||||
* e.g ["", "a=x&b=y", "c=z"]
|
||||
* @return {Array<object>} Array of formdata params
|
||||
* e.g [{ name: 'a', value: 'x' }, { name: 'b', value: 'y'}, { name: 'c', value: 'z'}]
|
||||
*/
|
||||
function parseFormData(sections) {
|
||||
if (!sections) {
|
||||
if (!sections || !sections.length) {
|
||||
return [];
|
||||
}
|
||||
const formDataParams = [];
|
||||
const searchStr = sections
|
||||
// Filter out empty sections
|
||||
.filter(str => /\S/.test(str))
|
||||
.join("&");
|
||||
|
||||
return sections
|
||||
.replace(/^&/, "")
|
||||
.split("&")
|
||||
.map(e => {
|
||||
const firstEqualSignIndex = e.indexOf("=");
|
||||
const paramName =
|
||||
firstEqualSignIndex !== -1 ? e.slice(0, firstEqualSignIndex) : e;
|
||||
const paramValue =
|
||||
firstEqualSignIndex !== -1 ? e.slice(firstEqualSignIndex + 1) : "";
|
||||
return {
|
||||
name: paramName ? getUnicodeUrlPath(paramName) : "",
|
||||
value: paramValue ? getUnicodeUrlPath(paramValue) : "",
|
||||
};
|
||||
const params = new URLSearchParams(searchStr);
|
||||
for (const [key, value] of params) {
|
||||
formDataParams.push({
|
||||
name: getUnicodeUrlPath(key),
|
||||
value: getUnicodeUrlPath(value),
|
||||
});
|
||||
}
|
||||
return formDataParams;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue