Use PathBuf.clone instead of to_path_buf
This commit is contained in:
parent
c4e231c9e0
commit
c4b0f31dbf
15
src/main.rs
15
src/main.rs
@ -276,8 +276,8 @@ fn handle_connection(
|
||||
relative_path = path;
|
||||
}
|
||||
|
||||
let mut pk_path = path.to_path_buf();
|
||||
let mut data_path = path.to_path_buf();
|
||||
let mut pk_path = path.clone();
|
||||
let mut data_path = path.clone();
|
||||
|
||||
let (pki_path, audio_path, start_level, relative_path, partial) = if relative_path.is_empty() {
|
||||
if access == Access::Full {
|
||||
@ -290,8 +290,8 @@ fn handle_connection(
|
||||
|
||||
(None, None, 0, String::new(), None)
|
||||
} else {
|
||||
let mut pki_path = path.to_path_buf();
|
||||
let mut audio_path = path.to_path_buf();
|
||||
let mut pki_path = path.clone();
|
||||
let mut audio_path = path.clone();
|
||||
|
||||
let path = percent_decode_str(relative_path).decode_utf8_lossy();
|
||||
if path.contains('_') {
|
||||
@ -321,13 +321,12 @@ fn handle_connection(
|
||||
|
||||
let file_paths = DocumentPaths {
|
||||
pk: &pk_path,
|
||||
pki: pki_path.as_ref().map(|path| path.as_ref()),
|
||||
audio: audio_path.as_ref().map(|path| path.as_ref()),
|
||||
pki: pki_path.as_ref().map(PathBuf::as_ref),
|
||||
audio: audio_path.as_ref().map(PathBuf::as_ref),
|
||||
data: &data_path,
|
||||
};
|
||||
|
||||
if let Some((_, ending)) = relative_path.rsplit_once('.') {
|
||||
let path = path.to_path_buf();
|
||||
let ending = ending.to_lowercase();
|
||||
match ending.as_ref() {
|
||||
"jpg" => reply_binary(stream, &relative_path, "image", "jpeg", path),
|
||||
@ -370,8 +369,6 @@ fn handle_connection(
|
||||
return;
|
||||
};
|
||||
|
||||
let path = path.to_path_buf();
|
||||
|
||||
handle_relative_connection(
|
||||
info,
|
||||
stream,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user