@@ -34,16 +34,16 @@ func NewTemplateThread(th *Thread) TemplateThread {
3434 for i , tweet := range th .Tweets {
3535 attachments := []TemplateAttachment {}
3636 for _ , attachment := range tweet .Attachments {
37- attachmentFile := attachment .Name (tweet .ID )
37+ attachmentFileName := attachment .Name (tweet .ID )
3838
3939 // Skip attachment if not downloaded
40- if _ , exists := attachmentDir .SubDir (attachmentFile ); ! exists {
40+ if _ , exists := attachmentDir .SubDir (attachmentFileName ); ! exists {
4141 continue
4242 }
4343
4444 attachments = append (attachments , TemplateAttachment {
45- Path : attachmentFile ,
46- Ext : filepath .Ext (attachmentFile ),
45+ Path : attachmentFileName ,
46+ Ext : filepath .Ext (attachmentFileName ),
4747 })
4848 }
4949 tweets = append (tweets , TemplateTweet {
@@ -82,8 +82,8 @@ func (a TemplateAttachment) IsVideo() bool {
8282 return valid
8383}
8484
85- func loadTemplate (threadDir * Directory , templateFile string , cssFile string ) (string , error ) {
86- html , err := loadHTMLTemplateFile (threadDir , templateFile )
85+ func loadTemplate (threadDir * Directory , templateFileName string , cssFileName string ) (string , error ) {
86+ html , err := loadHTMLTemplateFile (threadDir , templateFileName )
8787 if err != nil {
8888 return "" , err
8989 }
@@ -96,7 +96,7 @@ func loadTemplate(threadDir *Directory, templateFile string, cssFile string) (st
9696 return html , nil
9797 }
9898
99- return fmt .Sprintf (html , getCSSFile ( threadDir , cssFile )), nil
99+ return fmt .Sprintf (html , filepath . Clean ( getCSSFilePath ( threadDir , cssFileName ) )), nil
100100}
101101
102102const defaultTemplate = `
0 commit comments