mirror of
https://github.com/kovetskiy/mark.git
synced 2025-04-23 21:32:41 +08:00
fix #114 do not crash when resolving links on directories
This commit is contained in:
parent
3fcfcde298
commit
ee0a6e23e7
@ -70,7 +70,13 @@ func resolveLink(
|
|||||||
|
|
||||||
if len(link.filename) > 0 {
|
if len(link.filename) > 0 {
|
||||||
filepath := filepath.Join(base, link.filename)
|
filepath := filepath.Join(base, link.filename)
|
||||||
if _, err := os.Stat(filepath); err != nil {
|
|
||||||
|
stat, err := os.Stat(filepath)
|
||||||
|
if err != nil {
|
||||||
|
return "", nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if stat.IsDir() {
|
||||||
return "", nil
|
return "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,7 +161,10 @@ func parseLinks(markdown string) []markdownLink {
|
|||||||
|
|
||||||
// getConfluenceLink build (to be) link for Conflunce, and tries to verify from
|
// getConfluenceLink build (to be) link for Conflunce, and tries to verify from
|
||||||
// API if there's real link available
|
// API if there's real link available
|
||||||
func getConfluenceLink(api *confluence.API, space, title string) (string, error) {
|
func getConfluenceLink(
|
||||||
|
api *confluence.API,
|
||||||
|
space, title string,
|
||||||
|
) (string, error) {
|
||||||
link := fmt.Sprintf(
|
link := fmt.Sprintf(
|
||||||
"%s/display/%s/%s",
|
"%s/display/%s/%s",
|
||||||
api.BaseURL,
|
api.BaseURL,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user