Add a check for big base64 images
Moved from https://yoast.atlassian.net/browse/IM-1909 Reporter: @manuelaugustin
Description
We’ve encountered cased where people put very large base64-encoded data urls in their text (see attachment).
This not only crashes our analysis, but might also break browsers. So it’s bad practice to do this.
Detailed information provided by @Jono :
Best practice is to base64 encode small images so that the trade-off on not having to make a network request is positive. For large/complex images, that trade-off doesn't work out; you cripple the browser (and ship a mountain of bytes), and, break/bypass a whole bunch of browser heuristics.
This might be a common problem:
[It might be] common to copy/paste in a big base64 image, especially if it's moving between canvases (e.g., Google search > MS Word > Gutenberg)
The solution to this problem needs to be discussed.
- We could implement check for base64 images above a certain size in our Paper early in the analysis loop to display a warning about too large base64 images crippling your website (and our analysis).
- We could also replace the
srcvalue for a base64 image to something else.
Here's an example file containing a base64 image: description.txt
Comment from Hanna Worku:
Would this work as a new condition the the Images assessment?
Please inform the customer of conversation # 1010926 when this conversation has been closed.
The SEO data optimization failed for the above customer with error "too much recursion" because one of their posts has a big base64 image. The response for /wp-json/yoast/v1/prominent_words/get_content was truncated (Firefox).
Please inform the customer of conversation # 1031752 when this conversation has been closed.
Please inform the customer of conversation # 1049204 when this conversation has been closed.
Please inform the customer of conversation # 1058610 when this conversation has been closed.
Please inform the customer of conversation # 1152149 when this conversation has been closed.
Please inform the customer of conversation # 1249261 when this conversation has been closed.
Please inform the customer of conversation # 1259115 when this conversation has been closed.
Please inform the customer of conversation # 1263084 when this conversation has been closed.