mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
Refactor plugins-settings.js to improve handling of key-value pairs by allowing values to contain '=' characters
This commit is contained in:
parent
855ddaf9f3
commit
ee708e44f7
1 changed files with 6 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue