소스 검색

:bug: Custom sorting not maintained after importing .sy.zip Fix https://github.com/siyuan-note/siyuan/issues/8283

Liang Ding 2 년 전
부모
커밋
4125a61fc6
1개의 변경된 파일6개의 추가작업 그리고 3개의 파일을 삭제
  1. 6 3
      kernel/model/import.go

+ 6 - 3
kernel/model/import.go

@@ -243,13 +243,16 @@ func ImportSY(zipPath, boxID, toPath string) (err error) {
 
 
 		sortData, sortErr = gulu.JSON.MarshalJSON(fullSortIDs)
 		sortData, sortErr = gulu.JSON.MarshalJSON(fullSortIDs)
 		if nil != sortErr {
 		if nil != sortErr {
-			logging.LogErrorf("marshal temp full sort conf failed: %s", sortErr)
+			logging.LogErrorf("marshal box full sort conf failed: %s", sortErr)
 		} else {
 		} else {
-			sortErr = filelock.WriteFile(sortPath, sortData)
+			sortErr = filelock.WriteFile(boxSortPath, sortData)
 			if nil != sortErr {
 			if nil != sortErr {
-				logging.LogErrorf("write temp full sort conf failed: %s", sortErr)
+				logging.LogErrorf("write box full sort conf failed: %s", sortErr)
 			}
 			}
 		}
 		}
+		if removeErr := os.RemoveAll(sortPath); nil != removeErr {
+			logging.LogErrorf("remove temp sort conf failed: %s", removeErr)
+		}
 	}
 	}
 
 
 	// 重命名文件路径
 	// 重命名文件路径