Skip to content

Commit

Permalink
fix kovetskiy#114 do not crash when resolving links on directories
Browse files Browse the repository at this point in the history
  • Loading branch information
kovetskiy committed Sep 11, 2021
1 parent 3fcfcde commit ee0a6e2
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions pkg/mark/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,13 @@ func resolveLink(

if len(link.filename) > 0 {
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
}

Expand Down Expand Up @@ -155,7 +161,10 @@ func parseLinks(markdown string) []markdownLink {

// getConfluenceLink build (to be) link for Conflunce, and tries to verify from
// 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(
"%s/display/%s/%s",
api.BaseURL,
Expand Down

0 comments on commit ee0a6e2

Please sign in to comment.