I noticed that
KNL-101 (Interpret content type if unknown) added extra retrieval and saving of resources.
The following happens when saving a file (very high-level):
- The file is saved
- Read again from storage
- Content type is fixed
- saved again
Note: not all steps are done every time.
The attached patch takes what is done in
KNL-101 and with a bit of refactor it fix the content type without reloading and saving again.
I did test this but I think more testing is in order to make sure the stream is not corrupted.