Fixed double slashes in url

This commit is contained in:
G2-Games 2025-05-27 15:53:15 -05:00
parent b1cebb1901
commit 7047ab1b6e
2 changed files with 7 additions and 6 deletions

View file

@ -14,7 +14,7 @@ workspace = true
[dependencies]
anyhow = "1.0"
base64 = "0.22.1"
base64 = "0.22"
chrono = { version = "0.4", features = ["serde"] }
clap = { version = "4.5", features = ["derive", "unicode"] }
directories = "6.0"
@ -30,6 +30,5 @@ tokio-tungstenite = { version = "0.26", features = ["native-tls"] }
tokio-util = { version = "0.7", features = ["codec"] }
toml = "0.8"
url = { version = "2.5", features = ["serde"] }
uuid = { version = "1.11", features = ["serde", "v4"] }
confetti_box = { path = "../confetti-box" }

View file

@ -7,7 +7,7 @@ use confetti_box::{database::MochiFile, endpoints::ServerInfo, strings::{parse_t
use futures_util::{stream::FusedStream as _, SinkExt as _, StreamExt as _};
use indicatif::{ProgressBar, ProgressStyle};
use owo_colors::OwoColorize;
use reqwest::Client;
use reqwest::{header::HeaderValue, Client};
use serde::{Deserialize, Serialize};
use thiserror::Error;
use tokio::{fs::File, io::{AsyncReadExt, AsyncWriteExt}, join};
@ -146,7 +146,7 @@ async fn main() -> Result<()> {
date,
time,
pretty_time(duration.num_seconds(), BreakStyle::Space, TimeGranularity::Seconds),
"URL:".truecolor(174,196,223).bold(), (url.to_string() + "/f/" + &response.mmid().to_string()).underline()
"URL:".truecolor(174,196,223).bold(), (url.to_string() + "f/" + &response.mmid().to_string()).underline()
);
}
}
@ -402,7 +402,9 @@ async fn upload_file<P: AsRef<Path>>(
if let Some(l) = login {
request.headers_mut().insert(
"Authorization",
format!("Basic {}", BASE64_URL_SAFE.encode(format!("{}:{}", l.user, l.pass))).parse().unwrap()
HeaderValue::from_str(
&("Basic ".to_string() + &BASE64_URL_SAFE.encode(l.user.to_string() + ":" + &l.pass))
).unwrap()
);
}
@ -411,7 +413,7 @@ async fn upload_file<P: AsRef<Path>>(
// Upload the file in chunks
let upload_task = async move {
let mut chunk = vec![0u8; 20_000];
let mut chunk = vec![0u8; 200_000];
loop {
let read_len = file.read(&mut chunk).await.unwrap();
if read_len == 0 {