Skip to content

Commit

Permalink
feat: remove receiver limit on .xdc size
Browse files Browse the repository at this point in the history
If we have downloaded the file anyway,
might as well allow to open it.
  • Loading branch information
link2xt committed Dec 1, 2023
1 parent 7beccd9 commit 9cc9579
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions src/webxdc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@ const WEBXDC_DEFAULT_ICON: &str = "__webxdc__/default-icon.png";
/// it is planned to raise that limit as needed in subsequent versions.
const WEBXDC_SENDING_LIMIT: u64 = 655360;

/// Be more tolerant for .xdc sizes on receiving -
/// might be, the senders version uses already a larger limit
/// and not showing the .xdc on some devices would be even worse ux.
const WEBXDC_RECEIVING_LIMIT: u64 = 4194304;

/// Raw information read from manifest.toml
#[derive(Debug, Deserialize, Default)]
#[non_exhaustive]
Expand Down Expand Up @@ -218,14 +213,6 @@ impl Context {
return Ok(false);
}

if file.len() as u64 > WEBXDC_RECEIVING_LIMIT {
info!(
self,
"{} exceeds receiving limit of {} bytes", &filename, WEBXDC_RECEIVING_LIMIT
);
return Ok(false);
}

let archive = match async_zip::read::mem::ZipFileReader::new(file.to_vec()).await {
Ok(archive) => archive,
Err(_) => {
Expand Down Expand Up @@ -905,8 +892,6 @@ mod tests {
async fn test_webxdc_file_limits() -> Result<()> {
assert!(WEBXDC_SENDING_LIMIT >= 32768);
assert!(WEBXDC_SENDING_LIMIT < 16777216);
assert!(WEBXDC_RECEIVING_LIMIT >= WEBXDC_SENDING_LIMIT * 2);
assert!(WEBXDC_RECEIVING_LIMIT < 16777216);
Ok(())
}

Expand Down

0 comments on commit 9cc9579

Please sign in to comment.