mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🐛 Create doc failed on non-Windows https://github.com/siyuan-note/siyuan/issues/9890
This commit is contained in:
parent
cf6895770c
commit
999a6b8606
1 changed files with 10 additions and 0 deletions
|
|
@ -257,6 +257,16 @@ func (box *Box) Ls(p string) (ret []*FileInfo, totals int, err error) {
|
|||
if util.IsReservedFilename(name) {
|
||||
continue
|
||||
}
|
||||
if strings.HasSuffix(name, ".tmp") {
|
||||
// 移除写入失败时产生的并且早于 30 分钟前的临时文件,近期创建的临时文件可能正在写入中
|
||||
removePath := filepath.Join(util.DataDir, box.ID, p, name)
|
||||
if info.ModTime().Before(time.Now().Add(-30 * time.Minute)) {
|
||||
if removeErr := os.Remove(removePath); nil != removeErr {
|
||||
logging.LogWarnf("remove tmp file [%s] failed: %s", removePath, removeErr)
|
||||
}
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
totals += 1
|
||||
fi := &FileInfo{}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue