Skip to content

Commit 97810a5

Browse files
committed
Merge remote-tracking branch 'origin/dev' into dev
2 parents 0d5d62f + 973f99b commit 97810a5

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

app/src/util/pathName.ts

+5-13
Original file line numberDiff line numberDiff line change
@@ -87,22 +87,14 @@ export const getAssetName = (assetPath: string) => {
8787
};
8888

8989
export const isLocalPath = (link: string) => {
90-
if (!link) {
90+
link = link?.trim();
91+
if (!link || link.length === 0) {
9192
return false;
9293
}
9394

94-
link = link.trim();
95-
if (1 > link.length) {
96-
return false;
97-
}
98-
99-
link = link.toLowerCase();
100-
if (link.startsWith("assets/") || link.startsWith("file://") || link.startsWith("\\\\") /* Windows 网络共享路径 */) {
101-
return true;
102-
}
103-
104-
const colonIdx = link.indexOf(":");
105-
return 1 === colonIdx; // 冒号前面只有一个字符认为是 Windows 盘符而不是网络协议
95+
// Windows 网络共享路径双斜杠
96+
// 冒号前面只有一个字母认为是 Windows 盘符而不是网络协议
97+
return /^assets\/|file:\/\/|\\\\|[A-Z]:$/i.test(link);
10698
};
10799

108100
export const pathPosix = () => {

kernel/model/backlink.go

+8
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,10 @@ func GetBacklink(id, keyword, mentionKeyword string, beforeLen int, containChild
483483
}
484484
paragraphParents := sql.GetBlocks(paragraphParentIDs)
485485
for _, p := range paragraphParents {
486+
if nil == p {
487+
continue
488+
}
489+
486490
if "i" == p.Type || "h" == p.Type {
487491
linkRefs = append(linkRefs, fromSQLBlock(p, keyword, beforeLen))
488492
processedParagraphs.Add(p.ID)
@@ -589,6 +593,10 @@ func buildLinkRefs(defRootID string, refs []*sql.Ref, keywords []string) (ret []
589593
originalRefBlockIDs = map[string]string{}
590594
processedParagraphs := hashset.New()
591595
for _, parent := range paragraphParents {
596+
if nil == parent {
597+
continue
598+
}
599+
592600
if "NodeListItem" == parent.Type || "NodeBlockquote" == parent.Type || "NodeSuperBlock" == parent.Type {
593601
refBlock := parentRefParagraphs[parent.ID]
594602
if nil == refBlock {

kernel/model/blockinfo.go

+4
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,10 @@ func buildBacklinkListItemRefs(refDefs []*RefDefs) (originalRefBlockIDs map[stri
624624
luteEngine := util.NewLute()
625625
processedParagraphs := hashset.New()
626626
for _, parent := range paragraphParents {
627+
if nil == parent {
628+
continue
629+
}
630+
627631
if "NodeListItem" == parent.Type || "NodeBlockquote" == parent.Type || "NodeSuperBlock" == parent.Type {
628632
refBlock := parentRefParagraphs[parent.ID]
629633
if nil == refBlock {

0 commit comments

Comments
 (0)