Compare commits
2 commits
005c5f7cfa
...
ece742a1e3
| Author | SHA1 | Date | |
|---|---|---|---|
| ece742a1e3 | |||
| 1e05155cc1 |
3 changed files with 20 additions and 15 deletions
|
|
@ -108,10 +108,7 @@ impl AppState {
|
|||
|
||||
self.touch_progressbar();
|
||||
|
||||
let uploading = self
|
||||
.inner
|
||||
.get_uploading(&self.http)?
|
||||
.expect("we just checked!");
|
||||
let uploading = self.inner.expect_uploading();
|
||||
debug!("{uploading:?}");
|
||||
|
||||
let chunk = uploading.read(buffer)?;
|
||||
|
|
|
|||
|
|
@ -87,6 +87,12 @@ impl CacheFile {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn expect_uploading(&mut self) -> &mut file::Uploading {
|
||||
self.uploading
|
||||
.as_mut()
|
||||
.expect("expect_uploading called while not uploading")
|
||||
}
|
||||
|
||||
pub fn peek_uploading(&self) -> Option<&file::Uploading> {
|
||||
self.uploading.as_ref()
|
||||
}
|
||||
|
|
@ -103,21 +109,23 @@ impl CacheFile {
|
|||
}
|
||||
|
||||
pub fn rewind_chunk(mut self) -> Option<Self> {
|
||||
let Some(upl) = self.uploading.take() else {
|
||||
panic!("rewind_chunk called while not uploading");
|
||||
};
|
||||
|
||||
self.uploading = Some(upl.rewind()?);
|
||||
self.uploading = Some(
|
||||
self.uploading
|
||||
.take()
|
||||
.expect("rewind_chunk called while not uploading")
|
||||
.rewind()?,
|
||||
);
|
||||
|
||||
Some(self)
|
||||
}
|
||||
|
||||
pub fn abort_upload(&mut self) {
|
||||
let Some(upl) = self.uploading.take() else {
|
||||
panic!("abort_upload called while not uploading");
|
||||
};
|
||||
|
||||
self.files.push_front(upl.abort());
|
||||
self.files.push_front(
|
||||
self.uploading
|
||||
.take()
|
||||
.expect("abort_upload called while not uploading")
|
||||
.abort(),
|
||||
);
|
||||
}
|
||||
|
||||
pub fn share_notify(&self, client: &impl Client) -> sharry::Result<()> {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ fn find_cause(
|
|||
trace!("std::io::Error {error:?}");
|
||||
|
||||
if let Some(msg) = error.get_ref().map(ToString::to_string) {
|
||||
if msg == "failed to lookup address information: Name does not resolve" {
|
||||
if msg.starts_with("failed to lookup address information") {
|
||||
ClientError::InvalidParameter(sharry::Parameter::Uri(uri.to_string()))
|
||||
} else {
|
||||
error.into()
|
||||
|
|
|
|||
Loading…
Reference in a new issue