Skip to content

Commit

Permalink
Fix an attachment suffix parsing proble
Browse files Browse the repository at this point in the history
  • Loading branch information
luxi78 committed Jul 9, 2021
1 parent 4f6952a commit 78af967
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 16 additions & 1 deletion def.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,20 @@ type Resource struct {
*FileInfo
}
func (r Resource) getFileName() string {
return fmt.Sprintf("%s.%s", r.metaId, r.metaFileExt)
var fileName string
if /*len(r.metaFileExt) > 0*/false {
fileName = fmt.Sprintf("%s.%s", r.metaId, r.metaFileExt)
} else {
resPath := path.Join(*SrcPath, "resources")
c, err := ioutil.ReadDir(resPath)
CheckError(err)
for _, entry := range c {
if entry.IsDir() {continue}
if strings.Index(entry.Name(), r.metaId) >=0 {
fileName = entry.Name()
break
}
}
}
return fileName
}
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func main() {
}()

<-done
fmt.Println("\n\nDone!\n")
fmt.Printf("\n\nDone!\n\n")
fmt.Println(fmt.Sprintf("The next step is to open %s as vault in Obsidian, Then you will see what you want to see.", *DestPath))

}

0 comments on commit 78af967

Please sign in to comment.