Selaa lähdekoodia

Merge remote-tracking branch 'origin/dev' into dev

Vanessa 1 vuosi sitten
vanhempi
commit
1e9f11b6d2
5 muutettua tiedostoa jossa 17 lisäystä ja 5 poistoa
  1. 0 0
      app/stage/protyle/js/lute/lute.min.js
  2. 8 1
      kernel/api/lute.go
  3. 1 1
      kernel/go.mod
  4. 2 2
      kernel/go.sum
  5. 6 1
      kernel/model/assets.go

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
app/stage/protyle/js/lute/lute.min.js


+ 8 - 1
kernel/api/lute.go

@@ -17,8 +17,8 @@
 package api
 
 import (
-	"github.com/siyuan-note/siyuan/kernel/treenode"
 	"net/http"
+	"net/url"
 	"path/filepath"
 	"strings"
 
@@ -30,6 +30,7 @@ import (
 	"github.com/siyuan-note/filelock"
 	"github.com/siyuan-note/logging"
 	"github.com/siyuan-note/siyuan/kernel/model"
+	"github.com/siyuan-note/siyuan/kernel/treenode"
 	"github.com/siyuan-note/siyuan/kernel/util"
 )
 
@@ -131,6 +132,12 @@ func html2BlockDOM(c *gin.Context) {
 				localPath = strings.TrimPrefix(localPath, "/")
 			}
 
+			unescaped, _ := url.PathUnescape(localPath)
+			if unescaped != localPath {
+				// `Convert network images/assets to local` supports URL-encoded local file names https://github.com/siyuan-note/siyuan/issues/9929
+				localPath = unescaped
+			}
+
 			if !filepath.IsAbs(localPath) {
 				// Kernel crash when copy-pasting from some browsers https://github.com/siyuan-note/siyuan/issues/9203
 				return ast.WalkContinue

+ 1 - 1
kernel/go.mod

@@ -9,7 +9,7 @@ require (
 	github.com/88250/clipboard v0.1.5
 	github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48
 	github.com/88250/gulu v1.2.3-0.20231209020950-b7b6994e395c
-	github.com/88250/lute v1.7.6-0.20231219041316-775fdaf49900
+	github.com/88250/lute v1.7.6-0.20231220014330-9cf092e41060
 	github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c
 	github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
 	github.com/ClarkThan/ahocorasick v0.0.0-20231011042242-30d1ef1347f4

+ 2 - 2
kernel/go.sum

@@ -10,8 +10,8 @@ github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950 h1:Pa5hMiBceT
 github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
 github.com/88250/gulu v1.2.3-0.20231209020950-b7b6994e395c h1:Fas3hxqP33xA9KKDV50jUmppiiOukk5bdV00Hk5VSSk=
 github.com/88250/gulu v1.2.3-0.20231209020950-b7b6994e395c/go.mod h1:pTWnjt+6qUqNnP9xltswsJxgCBVu3C7eW09u48LWX0k=
-github.com/88250/lute v1.7.6-0.20231219041316-775fdaf49900 h1:fhfSJw90z5SDbNma8RNqrSqFRmnm9DlImPwN5g9i9fg=
-github.com/88250/lute v1.7.6-0.20231219041316-775fdaf49900/go.mod h1:+wUqx/1kdFDbWtxn9LYJlaCOAeol2pjSO6w+WJTVQsg=
+github.com/88250/lute v1.7.6-0.20231220014330-9cf092e41060 h1:fhcfwAcMSKuwGYjQqgBxeXVH6xKIpDtn9gT6xsdfI5c=
+github.com/88250/lute v1.7.6-0.20231220014330-9cf092e41060/go.mod h1:+wUqx/1kdFDbWtxn9LYJlaCOAeol2pjSO6w+WJTVQsg=
 github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c h1:Dl/8S9iLyPMTElnWIBxmjaLiWrkI5P4a21ivwAn5pU0=
 github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c/go.mod h1:S5YT38L/GCjVjmB4PB84PymA1qfopjEhfhTNQilLpv4=
 github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=

+ 6 - 1
kernel/model/assets.go

@@ -113,7 +113,7 @@ func NetImg2LocalAssets(rootID, originalURL string) (err error) {
 				u := string(dest)[7:]
 				unescaped, _ := url.PathUnescape(u)
 				if unescaped != u {
-					// `Convert network images to local` supports URL-encoded local file names https://github.com/siyuan-note/siyuan/issues/9929
+					// `Convert network images/assets to local` supports URL-encoded local file names https://github.com/siyuan-note/siyuan/issues/9929
 					u = unescaped
 				}
 				if !gulu.File.IsExist(u) || gulu.File.IsDir(u) {
@@ -274,6 +274,11 @@ func NetAssets2LocalAssets(rootID string) (err error) {
 
 		if bytes.HasPrefix(bytes.ToLower(dest), []byte("file://")) { // 处理本地文件链接
 			u := string(dest)[7:]
+			unescaped, _ := url.PathUnescape(u)
+			if unescaped != u {
+				// `Convert network images/assets to local` supports URL-encoded local file names https://github.com/siyuan-note/siyuan/issues/9929
+				u = unescaped
+			}
 			if !gulu.File.IsExist(u) || gulu.File.IsDir(u) {
 				return ast.WalkContinue
 			}

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä