remove unnecessary Uri::endpoint call

This commit is contained in:
Jörn-Michael Miehe 2025-06-14 12:34:58 +00:00
parent 10bb4feef5
commit 205af655e5

View file

@ -31,11 +31,11 @@ impl FileState {
fn start_upload(
self,
http: &impl Client,
endpoint: &str,
endpoint: impl FnOnce() -> String,
alias_id: &str,
) -> sharry::Result<file::Uploading> {
match self {
FileState::C(checked) => checked.start_upload(http, endpoint, alias_id),
FileState::C(checked) => checked.start_upload(http, &endpoint(), alias_id),
FileState::U(uploading) => Ok(uploading),
}
}
@ -105,11 +105,12 @@ impl CacheFile {
pub fn pop_file(&mut self, http: &impl Client) -> Option<file::Uploading> {
if let Some(state) = self.files.pop_front() {
let endpoint = self
.uri
.endpoint(format!("alias/upload/{}/files/tus", self.share_id));
let endpoint = || {
self.uri
.endpoint(format!("alias/upload/{}/files/tus", self.share_id))
};
// TODO somehow retry
Some(state.start_upload(http, &endpoint, &self.alias_id).unwrap()) // HACK unwrap
Some(state.start_upload(http, endpoint, &self.alias_id).unwrap()) // HACK unwrap
} else {
None
}