mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-01-23 02:35:14 +00:00
Bug fix: Fixes saving settings returning error.
Fixes [Bug]: Error saving Stream Settings Fixes #535
This commit is contained in:
parent
071561c570
commit
87d2131789
1 changed files with 19 additions and 4 deletions
|
|
@ -322,7 +322,8 @@ const SettingsPage = () => {
|
|||
let val = null;
|
||||
switch (key) {
|
||||
case 'm3u-hash-key':
|
||||
val = value.value.split(',');
|
||||
// Split comma-separated string, filter out empty strings
|
||||
val = value.value ? value.value.split(',').filter(v => v) : [];
|
||||
break;
|
||||
case 'dvr-pre-offset-minutes':
|
||||
case 'dvr-post-offset-minutes':
|
||||
|
|
@ -408,12 +409,26 @@ const SettingsPage = () => {
|
|||
for (const settingKey in values) {
|
||||
// Only compare against existing value if the setting exists
|
||||
const existing = settings[settingKey];
|
||||
|
||||
// Convert array values (like m3u-hash-key) to comma-separated strings
|
||||
let stringValue;
|
||||
if (Array.isArray(values[settingKey])) {
|
||||
stringValue = values[settingKey].join(',');
|
||||
} else {
|
||||
stringValue = `${values[settingKey]}`;
|
||||
}
|
||||
|
||||
// Skip empty values to avoid validation errors
|
||||
if (!stringValue) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!existing) {
|
||||
// Create new setting on save
|
||||
changedSettings[settingKey] = `${values[settingKey]}`;
|
||||
} else if (String(values[settingKey]) !== String(existing.value)) {
|
||||
changedSettings[settingKey] = stringValue;
|
||||
} else if (stringValue !== String(existing.value)) {
|
||||
// If the user changed the setting's value from what's in the DB:
|
||||
changedSettings[settingKey] = `${values[settingKey]}`;
|
||||
changedSettings[settingKey] = stringValue;
|
||||
|
||||
// Check if M3U hash key was changed
|
||||
if (settingKey === 'm3u-hash-key') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue