Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added test for images w/o extensions for image size util #9367

Merged
merged 1 commit into from Jan 4, 2018

Conversation

aileen
Copy link
Member

@aileen aileen commented Jan 4, 2018

closes #9022

Images without extensions don't need to be manipulated, as we're now reading the bytes and pass those to the image-size lib.

This PR adds another user-agent to emulate multiple browser requests, as I stumbled over an example where the image without extension is protected otherwise.

Added a test, that works with above mentioned image, but is currently mocked. Nevertheless, the image worked as a PoC, that we're able to read the bytes of an image without its extension and still return the dimensions of the image.

@@ -99,6 +99,40 @@ describe('lib/image: image size', function () {
}).catch(done);
});

it('[success] should return image dimensions when no image extension given', function (done) {

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

closes TryGhost#9022

Images without extensions don't need to be manipulated, as we're now reading the bytes and pass those to the `image-size` lib.

This PR adds another `user-agent` to emulate multiple browser requests, as I stumbled over an example where the image without extension is protected otherwise.

Added a test, that works with above mentioned image, but is currently mocked. Nevertheless, the image worked as a PoC, that we're able to read the bytes of an image without its extension and still return the dimensions of the image.
Copy link
Contributor

@kirrg001 kirrg001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PoC works. I can't tell if this solves another use case without image extension, but let's try this 👍 The only known other case are images from unsplash and they work already.

@kirrg001 kirrg001 merged commit 19a6c8a into TryGhost:master Jan 4, 2018
@aileen aileen deleted the images-no-extensions branch April 10, 2018 05:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Amperize issues
2 participants