Compare commits

..

No commits in common. "d6b2d53249991b0366c81a230ea97fc78bc0c70f" and "ae5965a7da12126307a1753531b7780af749a713" have entirely different histories.

3 changed files with 7 additions and 14 deletions

View file

@ -17,20 +17,16 @@ impl Builder {
} }
} }
pub const fn needs_password(mut self) -> Self { pub fn needs_password(mut self) -> Self {
self.needs_password = true; self.needs_password = true;
self self
} }
// False positive
#[allow(clippy::missing_const_for_fn)]
pub fn file_name(mut self, name: String) -> Self { pub fn file_name(mut self, name: String) -> Self {
self.file_name = Some(name); self.file_name = Some(name);
self self
} }
// False positive
#[allow(clippy::missing_const_for_fn)]
pub fn language(mut self, language: String) -> Self { pub fn language(mut self, language: String) -> Self {
self.language = Some(language); self.language = Some(language);
self self

View file

@ -151,12 +151,8 @@ fn handle_upload(
} }
if !no_file_name_hint { if !no_file_name_hint {
let file_name = path.and_then(|path| { if let Some(path) = path {
path.file_name() fragment = fragment.file_name(path.to_string_lossy().to_string());
.map(|str| str.to_string_lossy().to_string())
});
if let Some(file_name) = file_name {
fragment = fragment.file_name(file_name);
} }
} }
@ -164,7 +160,7 @@ fn handle_upload(
fragment = fragment.language(language); fragment = fragment.language(language);
} }
url.set_fragment(Some(fragment.build().expose_secret())); url.set_fragment(Some(&fragment.build().expose_secret()));
println!("{url}"); println!("{url}");

View file

@ -159,10 +159,11 @@ fn guess_mime_type(name_hint: Option<&str>, data: &[u8]) -> &'static str {
// support. As a result, we can probably just get the first one. // support. As a result, we can probably just get the first one.
log!("[rs] Mime type inferred from extension."); log!("[rs] Mime type inferred from extension.");
return mime_type; return mime_type;
} else {
log!("[rs] No mime type found for extension, falling back to introspection.");
} }
log!("[rs] No mime type found for extension, falling back to introspection.");
} }
tree_magic_mini::from_u8(data) tree_magic_mini::from_u8(&data)
} }
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]