docs.rs icon indicating copy to clipboard operation
docs.rs copied to clipboard

show "source file too big" when fetching source files that are bigger than our limit

Open syphar opened this issue 1 year ago • 1 comments
trafficstars

We regularly see errors in our source views where the file size extends our configured Config::max_file_size or Config::max_file_size_html.

Since we're currently not streaming the content, and we do syntax hilighting on these files, we limit the size.

In case of the respective error (error::SizeLimitReached), we could show a better error to the user instead of just "error fetching source file". Also we don't need this to be a server error and reported as such.

This is an example file that is too big: https://docs.rs/crate/qt_core/latest/source/ritual_db_v1.json, we have more in sentry

syphar avatar Apr 04 '24 02:04 syphar

  • the respective handler is web::source::source_browser_handler
  • using templates/crate/source.html as template.

syphar avatar Apr 04 '24 02:04 syphar

@syphar hi, I want to take a look into this issue as a newbie.

~I couldn't find signature you have mentioned above searching entire code in this repo. Could you provide me with more specific suggestion about this?~

EDIT: I've cloned and searched in different repo, I may be able to find it, sorry for that!

shusann01116 avatar May 10 '24 14:05 shusann01116

this is awesome, thank you for the help! will look at the PR

syphar avatar May 12 '24 19:05 syphar

I think this issue can be closed for now 😂 I misused the closing keywords...

shusann01116 avatar Jun 12 '24 00:06 shusann01116

Very true, thanks!

syphar avatar Jun 12 '24 05:06 syphar