Skip to content

Commit

Permalink
Merge pull request gethomepage#1640 from benphelps/feature/handle-inv…
Browse files Browse the repository at this point in the history
…alid-service-fields

Handle invalid fields syntax in service labels
  • Loading branch information
shamoon authored Jun 28, 2023
2 parents b04ed36 + a2fe1ee commit 2e892ac
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/utils/config/service-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2e892ac

Please sign in to comment.