diff --git a/src/format/chromium_pdf/mod.rs b/src/format/chromium_pdf/mod.rs index 5fa260d..5a5a5d5 100644 --- a/src/format/chromium_pdf/mod.rs +++ b/src/format/chromium_pdf/mod.rs @@ -26,8 +26,13 @@ pub mod result; /// Renders the document to pdf and returns the resulting bytes pub fn render_to_pdf(document: Document) -> PdfRenderingResult> { let cache = CacheStorage::new(); - let mut file_path = PathBuf::from(format!("tmp-document.html")); + let mut file_path = PathBuf::from("tmp-document.html"); file_path = cache.get_file_path(&file_path); + + if !file_path.parent().map(|p| p.exists()).unwrap_or(false) { + file_path = PathBuf::from(".tmp-document.html") + } + let config = document.config.clone(); let mathjax = config.lock().features.include_mathjax; diff --git a/src/utils/caching.rs b/src/utils/caching.rs index 2114f60..fc3c4f9 100644 --- a/src/utils/caching.rs +++ b/src/utils/caching.rs @@ -35,6 +35,7 @@ impl CacheStorage { if let Some(extension) = path.extension() { file_name.set_extension(extension); } + log::trace!("Cache path is {:?}", path); return self.location.join(PathBuf::from(file_name)); }