Skip to content

Commit

Permalink
fix: fix metadata for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
vicanso committed Oct 19, 2024
1 parent 37b6cdf commit 843861b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/plugin/directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ fn get_cacheable_and_headers_from_meta(
let content_type = HeaderValue::from_str(&value).unwrap();
let mut headers = vec![(header::CONTENT_TYPE, content_type)];

#[cfg(unix)]
let size = meta.size() as usize;
#[cfg(windows)]
let size = meta.file_size() as usize;
if let Ok(mod_time) = meta.modified() {
let value = mod_time
.duration_since(UNIX_EPOCH)
Expand Down Expand Up @@ -257,6 +260,7 @@ fn get_autoindex_html(path: &Path) -> Result<String, String> {
let mut is_file = false;
if f.is_file() {
is_file = true;
#[cfg(unix)]
let _ = f.metadata().map(|meta| {
size = ByteSize(meta.size()).to_string();
last_modified =
Expand Down

0 comments on commit 843861b

Please sign in to comment.