Skip to content

Commit a27fa6c

Browse files
committed
fix: add Array.isArray guard to section reset in config module
The single-section reset branch used `typeof sectionData === 'object'` to validate before in-place mutation, but arrays pass that check. Added `!Array.isArray(sectionData)` to prevent array data from being treated as a plain object during reset, which would corrupt it via Object.keys/delete/Object.assign.
1 parent 753b694 commit a27fa6c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/modules/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ export async function resetConfig(section) {
230230

231231
// Mutate in-place so references stay valid (deep clone to avoid shared refs)
232232
const sectionData = configCache[section];
233-
if (sectionData && typeof sectionData === 'object') {
233+
if (sectionData && typeof sectionData === 'object' && !Array.isArray(sectionData)) {
234234
for (const key of Object.keys(sectionData)) delete sectionData[key];
235235
Object.assign(sectionData, structuredClone(fileConfig[section]));
236236
} else {

0 commit comments

Comments
 (0)