normalizers: Fix crash in parseTuples when tuples is empty
This commit is contained in:
parent
df1780e590
commit
4ed0c4f42b
2 changed files with 5 additions and 0 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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')) {
|
||||
|
|
Loading…
Reference in a new issue