Compare commits

..

No commits in common. "ece742a1e3f461bc011d429425e87dd3d645274d" and "005c5f7cfa95410c43cbb6427d8bab0170ddf7ed" have entirely different histories.

3 changed files with 15 additions and 20 deletions

View file

@ -108,7 +108,10 @@ impl AppState {
self.touch_progressbar(); self.touch_progressbar();
let uploading = self.inner.expect_uploading(); let uploading = self
.inner
.get_uploading(&self.http)?
.expect("we just checked!");
debug!("{uploading:?}"); debug!("{uploading:?}");
let chunk = uploading.read(buffer)?; let chunk = uploading.read(buffer)?;

View file

@ -87,12 +87,6 @@ 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> { pub fn peek_uploading(&self) -> Option<&file::Uploading> {
self.uploading.as_ref() self.uploading.as_ref()
} }
@ -109,23 +103,21 @@ impl CacheFile {
} }
pub fn rewind_chunk(mut self) -> Option<Self> { pub fn rewind_chunk(mut self) -> Option<Self> {
self.uploading = Some( let Some(upl) = self.uploading.take() else {
self.uploading panic!("rewind_chunk called while not uploading");
.take() };
.expect("rewind_chunk called while not uploading")
.rewind()?, self.uploading = Some(upl.rewind()?);
);
Some(self) Some(self)
} }
pub fn abort_upload(&mut self) { pub fn abort_upload(&mut self) {
self.files.push_front( let Some(upl) = self.uploading.take() else {
self.uploading panic!("abort_upload called while not uploading");
.take() };
.expect("abort_upload called while not uploading")
.abort(), self.files.push_front(upl.abort());
);
} }
pub fn share_notify(&self, client: &impl Client) -> sharry::Result<()> { pub fn share_notify(&self, client: &impl Client) -> sharry::Result<()> {

View file

@ -32,7 +32,7 @@ fn find_cause(
trace!("std::io::Error {error:?}"); trace!("std::io::Error {error:?}");
if let Some(msg) = error.get_ref().map(ToString::to_string) { if let Some(msg) = error.get_ref().map(ToString::to_string) {
if msg.starts_with("failed to lookup address information") { if msg == "failed to lookup address information: Name does not resolve" {
ClientError::InvalidParameter(sharry::Parameter::Uri(uri.to_string())) ClientError::InvalidParameter(sharry::Parameter::Uri(uri.to_string()))
} else { } else {
error.into() error.into()