You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.
The regex const IMAGE_KEY_PATTERN_REGEX = /(([\/a-zA-Z0-9]+)\/([a-zA-Z0-9]+))_((\d+|auto)x(\d+|auto))(\.jpeg|\.jpg|\.png)/;
Is large and needs to be tested to make sure future changes don't break our filename schema.
The way images are currently resolved is by taking the s3 path of the failed image request, usually something like raw/1283ds7320dofiuasdofisddgn_400x300 and extracting the original file from it.
In this case it would be 1283ds7320dofiuasdofisddgn and we know that the user wants an image that is 400 pixels wide by 300 tall, respecting the aspect ratio (this is not the scope of this test though).
We need a test that will ensure that requests coming in for new image sizes are parsed and the original image path is extracted correctly.
The text was updated successfully, but these errors were encountered:
Also rejecting malformed sizes would be good, though more or less optional I'd say. A nice error message if you request 400x12032084438943257452435 would be hepful
Basically Sharp will guarantee that the other dimension is met exactly. Basically auto allows users to know all images will be X pixels tall, etc.
Ex: 400xauto will always come out 400 pixels wide, whereas 400x500 will be maximized to this dimension while still respecting the aspect ratio of the image, so it could come out 395x500 or something. The .max() argument is what provides this behavior from Sharp, just FYI.
The regex
const IMAGE_KEY_PATTERN_REGEX = /(([\/a-zA-Z0-9]+)\/([a-zA-Z0-9]+))_((\d+|auto)x(\d+|auto))(\.jpeg|\.jpg|\.png)/;
Is large and needs to be tested to make sure future changes don't break our filename schema.
The way images are currently resolved is by taking the s3 path of the failed image request, usually something like
raw/1283ds7320dofiuasdofisddgn_400x300
and extracting the original file from it.In this case it would be
1283ds7320dofiuasdofisddgn
and we know that the user wants an image that is400
pixels wide by300
tall, respecting the aspect ratio (this is not the scope of this test though).We need a test that will ensure that requests coming in for new image sizes are parsed and the original image path is extracted correctly.
The text was updated successfully, but these errors were encountered: