Merge branch 'bugfix/settings-normalize' into 'develop'

normalizers: Fix crash in parseTuples when tuples is empty

See merge request pleroma/admin-fe!281
This commit is contained in:
Haelwenn 2022-09-02 15:59:32 +00:00
commit 448eaceab8
3 changed files with 5 additions and 1 deletions

View file

@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed
### Fixed
- Crash when parsing tuples in Settings
## [2.4.0] - 2021-08-01

View file

@ -43,7 +43,6 @@
"clipboard": "2.0.11",
"element-ui": "2.15.9",
"js-cookie": "2.2.1",
"jsonlint": "1.6.3",
"localforage": "1.10.0",
"lodash": "4.17.21",
"lodash.debounce": "4.0.8",

View file

@ -56,6 +56,10 @@ export const parseNonTuples = (key, value) => {
}
// REFACTOR
export const parseTuples = (tuples, key) => {
if (!tuples.reduce) {
console.warn('Got empty tuples with key:', key)
return null
}
return tuples.reduce((accum, item) => {
if (key === ':rate_limit' ||
(key === 'Pleroma.Web.Endpoint.MetricsExporter' && item.tuple[0] === ':auth')) {