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