borkdude / quickblog

Light-weight static blog engine for Clojure and babashka
https://blog.michielborkent.nl/
MIT License
165 stars 28 forks source link

Post with missing pre-template.html file in cache not detected as stale #68

Closed jmglov closed 1 year ago

jmglov commented 1 year ago

When attempting to force re-render of a single post by deleting the corresponding pre-template.html file from the cache, the post is not correctly detected as stale, resulting in a file error when trying to load the post from the cache:

: jmglov.net; rm .cache/2022-06-15-summertime.md.pre-template.html                                                                      

: jmglov.net; bb quickblog render                                                                                                       
Reading post from cache: 2022-06-15-summertime.md                                                                                       
----- Error --------------------------------------------------------------------                                                        
Type:     java.io.FileNotFoundException                                                                                                 
Message:  .cache/2022-06-15-summertime.md.pre-template.html (No such file or directory)                                                 
Location: /home/jmglov/Documents/code/clojure/quickblog/src/quickblog/internal.clj:162:7                                                

----- Context ------------------------------------------------------------------                                                        
158: (defn read-cached-post [{:keys [cache-dir]} file]                                                                                  
159:   (let [cached-file (fs/file cache-dir (cache-file file))]                                                                         
160:     (delay                                                                                                                         
161:       (println "Reading post from cache:" (str file))                                                                              
162:       (slurp cached-file))))                                                                                                       
           ^--- .cache/2022-06-15-summertime.md.pre-template.html (No such file or directory)                                           
163:                                                                                                                                    
164: (defn load-post [{:keys [cache-dir default-metadata                                                                                
165:                          force-render rendering-system-files]                                                                      
166:                   :as opts}                                                                                                        
167:                  path]