More fixes
This commit is contained in:
parent
791bc6976b
commit
14a3555cf1
21 changed files with 549 additions and 99 deletions
|
|
@ -2,7 +2,7 @@ use std::collections::VecDeque;
|
|||
use std::path::{Path, PathBuf};
|
||||
use std::sync::Arc;
|
||||
|
||||
use anyhow::{bail, Context};
|
||||
use anyhow::Context;
|
||||
use parking_lot::Mutex;
|
||||
use polars::lazy::frame::LazyFrame;
|
||||
use rustc_hash::{FxHashMap, FxHashSet};
|
||||
|
|
@ -167,19 +167,16 @@ impl TravelTimeStore {
|
|||
}
|
||||
}
|
||||
|
||||
// Resolve slug to actual filename (may have numeric prefix)
|
||||
// Resolve slug to actual filename (may have numeric prefix).
|
||||
// Reject unknown slugs rather than falling back to raw input to prevent path traversal.
|
||||
let file_stem = self
|
||||
.slug_to_file
|
||||
.get(&key)
|
||||
.map(|val| val.as_str())
|
||||
.unwrap_or(slug);
|
||||
.ok_or_else(|| anyhow::anyhow!("Unknown travel destination: {mode}/{slug}"))?;
|
||||
let path = self
|
||||
.base_dir
|
||||
.join(mode)
|
||||
.join(format!("{}.parquet", file_stem));
|
||||
if !path.exists() {
|
||||
bail!("Travel time file not found: {}", path.display());
|
||||
}
|
||||
|
||||
let df = LazyFrame::scan_parquet(&path, Default::default())
|
||||
.with_context(|| format!("Failed to scan: {}", path.display()))?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue