Skip to content

Require yes/no from user if wasm downloading > 10 MB of data#156

Open
ianthomas23 wants to merge 3 commits into
mainfrom
http-check-size
Open

Require yes/no from user if wasm downloading > 10 MB of data#156
ianthomas23 wants to merge 3 commits into
mainfrom
http-check-size

Conversation

@ianthomas23
Copy link
Copy Markdown
Member

This adds a check for wasm http(s) requests on the size of the download. If it exceeds 10 MB, a prompt is displayed to the user to continue or not. For example:

Screenshot 2026-05-13 at 13 25 01

Note the line `Download size is 69.3 MB, continue [y/N]?

The idea is prompt the user to specifically OK a download that will consume a significant amount of browser storage. Note the filesystem usage here is 18 MB for a download of 69 MB, and we cannot advise on what the filesystem usage will be in advance.

Currently the 10 MB is hardcoded. It could be a separate env var I suppose, but we already have quite a few and should maybe avoid adding more unless we really have to. This does at least provide a starting point for future richer behaviour if we wish.

This includes a bit of a refactor of the wasm_http_response class. Now we have a single response per stream (i.e. per http(s) request) and a new read_buffer struct which is no longer part of the response but is used once per read call, which aligns better with how libgit2 behaves. This allows us to easily read the download size and headers just once, and we obtain a slight speedup for downloads with multiple reads as a result.

@ianthomas23 ianthomas23 added the enhancement New feature or request label May 13, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.52%. Comparing base (d7d2008) to head (f2ef4fb).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #156   +/-   ##
=======================================
  Coverage   88.52%   88.52%           
=======================================
  Files          62       62           
  Lines        2884     2884           
  Branches      358      358           
=======================================
  Hits         2553     2553           
  Misses        331      331           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant