Refactor plugins-settings.js to improve handling of key-value pairs by allowing values to contain '=' characters

This commit is contained in:
Théophile Diot 2025-01-14 17:33:07 +01:00
parent 855ddaf9f3
commit ee708e44f7
No known key found for this signature in database
GPG key ID: FA995104A0BA376A

View file

@ -360,7 +360,10 @@ $(document).ready(() => {
.trim()
.split("\n")
.reduce((acc, line) => {
const [key, value] = line.split("=");
const [key, ...valueParts] = line
.split("=")
.map((str) => str.trim());
const value = valueParts.join("=");
if (key && value !== undefined) {
acc[key.trim()] = value.trim();
}
@ -386,7 +389,8 @@ $(document).ready(() => {
.filter((line) => line && !line.startsWith("#"));
configLines.forEach((line) => {
const [key, value] = line.split("=").map((str) => str.trim());
const [key, ...valueParts] = line.split("=").map((str) => str.trim());
const value = valueParts.join("=");
if (!key || value === undefined) {
console.warn(`Skipping malformed line: ${line}`);
return;