Fixed: jfif photo uploads don't work #1984
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
Since a Windows update in December 2019, Microsoft has configured all of its customers' computers to use .jfif instead of .jpg as the default extension when saving JPEG files:
https://answers.microsoft.com/en-us/windows/forum/all/jpg-vs-jfif-extension/f66875d7-4780-4d55-b8da-9387de4139d4
Since the .jfif protocol has not been widely popular, it is not presently supported by OSSN.
We need to make sure that .jfif uploads work as well as .jpg uploads do.
Solution
In a handful of places, an configuration is sent to
OssnFile::setExtension()
that defines allowed file types. Wherever there has been found ".jpg" and ".jpeg" file extensions in that configuration, I have added ".jfif".I also added the reverse mapping (".jfif" to "image/jpeg" mime type) in the applicable places.
The original issue is found here: jfif photo uploads don't work #7
The revision in the main branch of my OSSN fork is here: baa0cb71e587c36ff7499aa5b60c9114d8594d70
Notes