Underscore fix for images
This commit is contained in:
parent
95653cde84
commit
c8f2cd8b66
10
src/main.rs
10
src/main.rs
@ -330,12 +330,20 @@ fn handle_connection(
|
||||
let mut audio_path = path.clone();
|
||||
|
||||
let path = percent_decode_str(relative_path).decode_utf8_lossy();
|
||||
if let Some((path, mut file)) = path.rsplit_once('/') {
|
||||
println!("{path} -> {file}");
|
||||
if path.contains('_') {
|
||||
let path = path.replace('_', " ");
|
||||
let replaced_file;
|
||||
if !file.contains('.') {
|
||||
replaced_file = file.replace('_', " ");
|
||||
file = &replaced_file;
|
||||
}
|
||||
let _ = write!(stream, "HTTP/1.1 308 Permanent Redirect\r\n");
|
||||
let _ = write!(stream, "Location: /{path}\r\n\r\n");
|
||||
let _ = write!(stream, "Location: /{path}/{file}\r\n\r\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
pk_path.push(format!("{path}.pk"));
|
||||
mld_path.push(format!("{path}.mld"));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user