fix: complete scan.rs demo dir path cleanup (A-4.2 P3)
Issues: 2 hardcoded demo paths Solution: Use MOMENTRY_SFTP_ROOT or relative fallback Verification: cargo check --lib passes
This commit is contained in:
+7
-1
@@ -242,7 +242,13 @@ async fn scan_files(
|
||||
Query(params): Query<ScanFilesQuery>,
|
||||
) -> Result<Json<ScanFilesResponse>, StatusCode> {
|
||||
let demo_dir_str = std::env::var("MOMENTRY_SFTP_ROOT")
|
||||
.unwrap_or_else(|_| "/Users/accusys/momentry/var/sftpgo/data/demo".to_string());
|
||||
.unwrap_or_else(|_| {
|
||||
std::env::current_exe()
|
||||
.ok()
|
||||
.and_then(|p| p.parent().map(|d| d.join("var/sftpgo/data/demo")))
|
||||
.map(|p| p.to_string_lossy().to_string())
|
||||
.unwrap_or_else(|| "var/sftpgo/data/demo".to_string())
|
||||
});
|
||||
let demo_dir = std::path::Path::new(&demo_dir_str);
|
||||
|
||||
let allowed_extensions = vec![
|
||||
|
||||
Reference in New Issue
Block a user