mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-02 23:08:49 +01:00
🎨 Fill in the alt text after converting network images to local https://github.com/siyuan-note/siyuan/issues/10583
This commit is contained in:
parent
9a42f69ba6
commit
f168e39768
1 changed files with 6 additions and 2 deletions
|
|
@ -132,7 +132,9 @@ func NetImg2LocalAssets(rootID, originalURL string) (err error) {
|
|||
name := filepath.Base(u)
|
||||
name = util.FilterUploadFileName(name)
|
||||
name = util.TruncateLenFileName(name)
|
||||
linkText.Tokens = []byte(name)
|
||||
if 1 > len(bytes.TrimSpace(linkText.Tokens)) {
|
||||
linkText.Tokens = []byte(name)
|
||||
}
|
||||
name = "net-img-" + name
|
||||
name = util.AssetName(name)
|
||||
writePath := filepath.Join(assetsDirPath, name)
|
||||
|
|
@ -209,7 +211,9 @@ func NetImg2LocalAssets(rootID, originalURL string) (err error) {
|
|||
name = strings.TrimSuffix(name, ext)
|
||||
name = util.FilterUploadFileName(name)
|
||||
name = util.TruncateLenFileName(name)
|
||||
linkText.Tokens = []byte(name)
|
||||
if 1 > len(bytes.TrimSpace(linkText.Tokens)) {
|
||||
linkText.Tokens = []byte(name)
|
||||
}
|
||||
name = "net-img-" + name + "-" + ast.NewNodeID() + ext
|
||||
writePath := filepath.Join(assetsDirPath, name)
|
||||
if err = filelock.WriteFile(writePath, data); nil != err {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue