mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🐛 API /asset/upload 使用子文件夹时返回结果不正确 Fix https://github.com/siyuan-note/siyuan/issues/7454
This commit is contained in:
parent
8d4519c7df
commit
c0c605b664
4 changed files with 33 additions and 36 deletions
|
|
@ -130,9 +130,11 @@ func Upload(c *gin.Context) {
|
|||
docDirLocalPath := filepath.Join(util.DataDir, bt.BoxID, path.Dir(bt.Path))
|
||||
assetsDirPath = getAssetsDir(filepath.Join(util.DataDir, bt.BoxID), docDirLocalPath)
|
||||
}
|
||||
|
||||
relAssetsDirPath := "assets"
|
||||
if nil != form.Value["assetsDirPath"] {
|
||||
assetsDirPath = form.Value["assetsDirPath"][0]
|
||||
assetsDirPath = filepath.Join(util.DataDir, assetsDirPath)
|
||||
relAssetsDirPath = form.Value["assetsDirPath"][0]
|
||||
assetsDirPath = filepath.Join(util.DataDir, relAssetsDirPath)
|
||||
}
|
||||
if !gulu.File.IsExist(assetsDirPath) {
|
||||
if err = os.MkdirAll(assetsDirPath, 0755); nil != err {
|
||||
|
|
@ -187,7 +189,7 @@ func Upload(c *gin.Context) {
|
|||
break
|
||||
}
|
||||
f.Close()
|
||||
succMap[baseName] = "assets/" + fName
|
||||
succMap[baseName] = path.Join(relAssetsDirPath, fName)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue