mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🐛 复制资源文件后导出再导入后丢失 Fix https://github.com/siyuan-note/siyuan/issues/5320
This commit is contained in:
parent
ea4f722edb
commit
a0a3d2f28e
3 changed files with 34 additions and 25 deletions
|
|
@ -159,19 +159,7 @@ func Upload(c *gin.Context) {
|
|||
// 已经存在同样数据的资源文件的话不重复保存
|
||||
succMap[baseName] = existAsset.Path
|
||||
} else {
|
||||
_, id := util.LastID(fName)
|
||||
ext := path.Ext(fName)
|
||||
fName = fName[0 : len(fName)-len(ext)]
|
||||
if !util.IsIDPattern(id) {
|
||||
id = ast.NewNodeID()
|
||||
fName = fName + "-" + id + ext
|
||||
} else {
|
||||
if !util.IsIDPattern(fName) {
|
||||
fName = fName[:len(fName)-len(id)-1] + "-" + id + ext
|
||||
} else {
|
||||
fName = fName + ext
|
||||
}
|
||||
}
|
||||
fName = util.AssetName(fName)
|
||||
writePath := filepath.Join(assetsDirPath, fName)
|
||||
if _, err = f.Seek(0, io.SeekStart); nil != err {
|
||||
errFiles = append(errFiles, fName)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue