Skip to content

Commit

Permalink
fix: #669
Browse files Browse the repository at this point in the history
  • Loading branch information
MliKiowa committed Dec 29, 2024
1 parent 3b86d3c commit 56cde4a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/webui/src/helper/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class WebUiConfigWrapper {
try {
const configPath = resolve(webUiPathWrapper.configPath, './webui.json');

if (!await fs.access(configPath, constants.R_OK | constants.W_OK).then(() => true).catch(() => false)) {
if (!await fs.access(configPath, constants.R_OK).then(() => true).catch(() => false)) {

This comment has been minimized.

Copy link
@wu-yafeng

wu-yafeng Dec 31, 2024

Contributor

这个逻辑貌似存在一些问题。
fs.access(...) 不可读时,依然在尝试写入,结合上下文来看,应该是文件不存在则写入默认配置。
是否应该考虑使用 constants.F_OK 来判断比较好?

await fs.writeFile(configPath, JSON.stringify(defaultconfig, null, 4));
}

Expand Down

0 comments on commit 56cde4a

Please sign in to comment.