Compare commits

...

2 Commits

Author SHA1 Message Date
minish 2e65f3744b
Merge branch 'main' of git.min.rip:min/breeze 2024-10-20 01:42:54 -04:00
minish ec050b19a5
fix empty file extensions (0.2.6) 2024-10-20 01:42:24 -04:00
3 changed files with 8 additions and 5 deletions

2
Cargo.lock generated
View File

@ -228,7 +228,7 @@ checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
[[package]]
name = "breeze"
version = "0.2.5"
version = "0.2.6"
dependencies = [
"anyhow",
"argh",

View File

@ -1,6 +1,6 @@
[package]
name = "breeze"
version = "0.2.5"
version = "0.2.6"
edition = "2021"
[dependencies]

View File

@ -148,10 +148,13 @@ impl Engine {
#[async_recursion::async_recursion]
pub async fn gen_saved_name(&self, ext: &str) -> String {
// generate a 6-character alphanumeric string
let id: String = Alphanumeric.sample_string(&mut rand::thread_rng(), 6);
let mut saved_name: String = Alphanumeric.sample_string(&mut rand::thread_rng(), 6);
// path on disk
let saved_name = format!("{}.{}", id, ext);
// if we have an extension, add it now
if !ext.is_empty() {
saved_name.push('.');
saved_name.push_str(ext);
}
if !self.has(&saved_name).await {
saved_name