From aa71984fd3af4c1f7b022a439496df75d73d917b Mon Sep 17 00:00:00 2001 From: eight Date: Mon, 18 Sep 2017 12:59:22 +0800 Subject: [PATCH] Fix: save name when updating usercss --- background/update.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/background/update.js b/background/update.js index 366cb242..648fa3cb 100644 --- a/background/update.js +++ b/background/update.js @@ -139,14 +139,16 @@ var updater = { } function maybeSave(json) { - const doSave = json.usercssData ? usercssHelper.save : saveStyle; json.id = style.id; - // no need to compare section code for usercss, they are built dynamically - return !save ? json : - doSave(Object.assign(json, { - name: null, // keep local name customizations - reason: 'update', - })); + if (!save) { + return json; + } + json.reason = 'update'; + if (json.usercssData) { + return usercssHelper.save(json); + } + json.name = null; // keep local name customizations + return saveStyle(json); } function styleJSONseemsValid(json) {