Browse Source

:sparkles: 资源文件重命名 https://github.com/siyuan-note/siyuan/issues/3454

Liang Ding 3 năm trước cách đây
mục cha
commit
33ea08dcd0
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      kernel/model/assets.go

+ 2 - 2
kernel/model/assets.go

@@ -462,7 +462,7 @@ func RenameAsset(oldPath, newName string) (err error) {
 		return
 		return
 	}
 	}
 
 
-	newPath := util.AssetName(newName) + filepath.Ext(oldPath)
+	newPath := "assets/" + util.AssetName(newName) + filepath.Ext(oldPath)
 	if err = gulu.File.Copy(filepath.Join(util.DataDir, oldPath), filepath.Join(util.DataDir, newPath)); nil != err {
 	if err = gulu.File.Copy(filepath.Join(util.DataDir, oldPath), filepath.Join(util.DataDir, newPath)); nil != err {
 		util.LogErrorf("copy asset [%s] failed: %s", oldPath, err)
 		util.LogErrorf("copy asset [%s] failed: %s", oldPath, err)
 		return
 		return
@@ -485,7 +485,7 @@ func RenameAsset(oldPath, newName string) (err error) {
 				}
 				}
 
 
 				if !bytes.Contains(data, []byte(oldPath)) {
 				if !bytes.Contains(data, []byte(oldPath)) {
-					return
+					continue
 				}
 				}
 
 
 				data = bytes.Replace(data, []byte(oldPath), []byte(newPath), -1)
 				data = bytes.Replace(data, []byte(oldPath), []byte(newPath), -1)