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

Fix http 500 error: Don't assume accept header exists #1

Merged
merged 1 commit into from
May 5, 2020

Conversation

didkan
Copy link
Collaborator

@didkan didkan commented May 5, 2020

Any client that don't send the accept header in its request will crash this module and produce a http 500 error from VSF.
The problem is the code assumes ´request.headers.accept` exists when trying to find out if the client accepts wepb images.
I found the error when checking the VSF error log on prod server so apparently this is a real issue. Maybe it's just bots and crawlers but this should still be fixed.

I added a "guard" that assumes non-webp support if request.headers.accept doesn't exist.

This PR was tested succesfully using Requestly (Chrome addon).

@didkan didkan merged commit 48432d4 into master May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant