Skip to content

Commit 78af967

Browse files
committed
Fix an attachment suffix parsing proble
1 parent 4f6952a commit 78af967

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

def.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,20 @@ type Resource struct {
7676
*FileInfo
7777
}
7878
func (r Resource) getFileName() string {
79-
return fmt.Sprintf("%s.%s", r.metaId, r.metaFileExt)
79+
var fileName string
80+
if /*len(r.metaFileExt) > 0*/false {
81+
fileName = fmt.Sprintf("%s.%s", r.metaId, r.metaFileExt)
82+
} else {
83+
resPath := path.Join(*SrcPath, "resources")
84+
c, err := ioutil.ReadDir(resPath)
85+
CheckError(err)
86+
for _, entry := range c {
87+
if entry.IsDir() {continue}
88+
if strings.Index(entry.Name(), r.metaId) >=0 {
89+
fileName = entry.Name()
90+
break
91+
}
92+
}
93+
}
94+
return fileName
8095
}

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func main() {
6565
}()
6666

6767
<-done
68-
fmt.Println("\n\nDone!\n")
68+
fmt.Printf("\n\nDone!\n\n")
6969
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))
7070

7171
}

0 commit comments

Comments
 (0)