Improve wiki linking
This commit is contained in:
+5
-4
@@ -115,13 +115,14 @@ func wikiTargetHref(target string) string {
|
||||
return b.String()
|
||||
}
|
||||
|
||||
// wikiTargetExists reports whether the on-disk folder backing the target
|
||||
// exists under root.
|
||||
// wikiTargetExists reports whether the on-disk path backing the target exists
|
||||
// under root. Any existing path — file or folder — counts as resolved; only a
|
||||
// missing path is treated as broken.
|
||||
func wikiTargetExists(root, target string) bool {
|
||||
target = normalizeWikiTarget(target)
|
||||
fsPath := filepath.Join(root, filepath.FromSlash(strings.TrimPrefix(target, "/")))
|
||||
info, err := os.Stat(fsPath)
|
||||
return err == nil && info.IsDir()
|
||||
_, err := os.Stat(fsPath)
|
||||
return err == nil
|
||||
}
|
||||
|
||||
// wikiDefaultDisplay returns the last segment of a target, or "/" for the root.
|
||||
|
||||
Reference in New Issue
Block a user