rust-lang / docs.rs

crates.io documentation generator
https://docs.rs
MIT License
956 stars 193 forks source link

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

Closed syphar closed 3 weeks ago

syphar commented 3 months ago

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 commented 3 months ago
shusann01116 commented 1 month ago

@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!

syphar commented 1 month ago

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

shusann01116 commented 3 weeks ago

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

syphar commented 3 weeks ago

Very true, thanks!