mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 15:40:12 +01:00
🧑💻 Fix API /api/asset/upload response body succMap field (#12361)
* 🐛 Fix API `/api/asset/upload` response body `succMap` field * 🐛 Fix #12255
This commit is contained in:
parent
6a3095c56c
commit
b924452eab
2 changed files with 3 additions and 3 deletions
|
|
@ -126,7 +126,7 @@ export class Options {
|
||||||
url: Constants.UPLOAD_ADDRESS,
|
url: Constants.UPLOAD_ADDRESS,
|
||||||
extraData: {},
|
extraData: {},
|
||||||
fieldName: "file[]",
|
fieldName: "file[]",
|
||||||
filename: (name: string) => name.replace(/[\\/:*?"'<>|]/g, ""),
|
filename: (name: string) => name.replace(/[\\/:*?"'<>|\[\]\(\)~!`&{}=#%$]/g, ""),
|
||||||
linkToImgUrl: "",
|
linkToImgUrl: "",
|
||||||
withCredentials: false,
|
withCredentials: false,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ func InsertLocalAssets(id string, assetPaths []string, isUpload bool) (succMap m
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
f.Close()
|
f.Close()
|
||||||
succMap[fName] = "assets/" + fName
|
succMap[baseName] = "assets/" + fName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IncSync()
|
IncSync()
|
||||||
|
|
@ -284,7 +284,7 @@ func Upload(c *gin.Context) {
|
||||||
os.RemoveAll(tmpDir2)
|
os.RemoveAll(tmpDir2)
|
||||||
}
|
}
|
||||||
|
|
||||||
succMap[fName] = strings.TrimPrefix(path.Join(relAssetsDirPath, fName), "/")
|
succMap[baseName] = strings.TrimPrefix(path.Join(relAssetsDirPath, fName), "/")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue