http.DetectContentType() implements the MIME sniff algorithm at https://mimesniff.spec.whatwg.org/. This is not really the correct algorithm to use for uploading files to Google Drive. Files such as .xlsx, .pptx, .docx, .apk, and other ZIP-based formats are incorrectly uploaded as plain ZIP files and cannot be viewed properly at drive.google.com.
Uploading as application/octet-stream allows the server to automatically detect the content type with a better algorithm that has much better results. I tested with apk, docx, zip, pdf, jpg, gif, png, html, txt, wav, and xml.
Before this change, I could not properly view/play wav or docx. apk files also showed up as plain ZIP. With this change, these files render correctly. The other files continued to work.
http.DetectContentType() implements the MIME sniff algorithm at https://mimesniff.spec.whatwg.org/. This is not really the correct algorithm to use for uploading files to Google Drive. Files such as .xlsx, .pptx, .docx, .apk, and other ZIP-based formats are incorrectly uploaded as plain ZIP files and cannot be viewed properly at drive.google.com.
Uploading as
application/octet-stream
allows the server to automatically detect the content type with a better algorithm that has much better results. I tested with apk, docx, zip, pdf, jpg, gif, png, html, txt, wav, and xml.Before this change, I could not properly view/play wav or docx. apk files also showed up as plain ZIP. With this change, these files render correctly. The other files continued to work.
Closes #104.