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/5971
This commit is contained in:
parent
f7d91a67b9
commit
e536f5d4b6
2 changed files with 12 additions and 1 deletions
|
|
@ -45,6 +45,12 @@ func InsertLocalAssets(id string, assetPaths []string) (succMap map[string]inter
|
|||
|
||||
docDirLocalPath := filepath.Join(util.DataDir, bt.BoxID, path.Dir(bt.Path))
|
||||
assets := getAssetsDir(filepath.Join(util.DataDir, bt.BoxID), docDirLocalPath)
|
||||
if !gulu.File.IsExist(assets) {
|
||||
if err = os.MkdirAll(assets, 0755); nil != err {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
for _, p := range assetPaths {
|
||||
fName := filepath.Base(p)
|
||||
fName = util.FilterUploadFileName(fName)
|
||||
|
|
@ -124,7 +130,9 @@ func Upload(c *gin.Context) {
|
|||
if nil != form.Value["assetsDirPath"] {
|
||||
assetsDirPath = form.Value["assetsDirPath"][0]
|
||||
assetsDirPath = filepath.Join(util.DataDir, assetsDirPath)
|
||||
if err := os.MkdirAll(assetsDirPath, 0755); nil != err {
|
||||
}
|
||||
if !gulu.File.IsExist(assetsDirPath) {
|
||||
if err = os.MkdirAll(assetsDirPath, 0755); nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue