Merge pull request #1640 from benphelps/feature/handle-invalid-service-fields

Handle invalid fields syntax in service labels
This commit is contained in:
shamoon 2023-06-28 08:50:04 -07:00 committed by GitHub
commit 2e892ac906
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -291,8 +291,15 @@ export function cleanServiceGroups(groups) {
enableQueue, // sonarr/radarr
} = cleanedService.widget;
const fieldsList = typeof fields === 'string' ? JSON.parse(fields) : fields;
let fieldsList = fields;
if (typeof fields === 'string') {
try { JSON.parse(fields) }
catch (e) {
logger.error("Invalid fields list detected in config for service '%s'", service.name);
fieldsList = null;
}
}
cleanedService.widget = {
type,
fields: fieldsList || null,