remove unnecessary Uri::endpoint call
This commit is contained in:
parent
10bb4feef5
commit
205af655e5
1 changed files with 7 additions and 6 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue