Paperclip relies on the file command to detect the mime type of uploads, rather than the extension, since the extension is provided by the user. Unfortunately file reports 'application/zip;' for pptx, docx, and xlsx files, so Paperclip thus stores the files with content_type = 'application/zip' rather than the correct mime types.
Most operating systems like Microsoft Windows, Mac OS X, or the various Linux distributions identify file types through file name extensions – usually the three characters following the dot ending a file name (example:.doc). Likewise, an operating system associates applications that should read and edit certain file types.
These files are technically zip files, but that's just an implementation detail that users don't care about - they want the files to open in the right programs. These seem like common enough file types that it's worth figuring out a solution. I'm happy to help with the code. FYI I did a little more research on this. There's a more recent version of file than what's on heroku that correctly determines the mime-type for these files. Unfortunately it's a pain to upgrade that for heroku-specific reasons. My outsider view is that it's not great for paperclip to assume I have an installed executable of a certain version if at all avoidable.
Download Google SketchUp 15.3.329. 3D design made easy by Google. SketchUp is a three-dimensional graphic design program that lets you easily and quickly build and model all kinds of 3D models. It comes with a complete tutorial which helps you learn how to use all of its tools in no time at all. Download SketchUp here to get started with our flexible and intuitive software for any project. Try a free download of our 3D house design software. Skip to main content. Is your school enrolled in Google's G Suite for Education? I don't know. What is your role? SketchUp for Mac is a 3D design app that allows you to create 3D models and, using an online service, get those models built. SketchUp for Mac installs easily but was not available from the App. Google sketch download for mac.
Some ways to go: • Use a gem like magic which uses FFI to directly link to libmagic (what file uses), but enhance it to compile libmagic at install time. I have no idea whether that works with jruby, but maybe it does. • Use a pure ruby solution that reads the same data that file uses for mime type determination. This seems daunting. • Use a different mime type database. I found, which uses the dataset the freedesktop.org people use for e.g., gnome. Mac os 7 emulator android. It's pure ruby - he's got his own process for converting their data into ruby code.
Unfortunately they don't detect xslx correctly. I submitted a patch (). MimeMagic also doesn't do the heuristic for text/plain vs application/octet-stream that file does, but a) that doesn't seem so hard and b) we can always fall back to file for that. I also attempted to compile my own file-formatted mime magic database (.mgc file) that we could include and point to with -m, but as far as I can tell those files are not compatible across different versions of file, so that doesn't work. I started a branch that works if you have a version of MimeMagic with my patch applied to the input xml. I saw those comments on the mimemagic tracker which is basically a non-starter. I don't think that the magic gem will work any better than file because it appears to be a core issue with libmagic.
Or, at least it depends on the system and what rules are added (which is I think what you said above). Describes adding rules derived from the Ubuntu utilities. (Which might provide more direction/support for your mimemagic change.) For us this was not an issue with Paperclip 3.2, but became an issue upgrading to 4.2. Paperclip now uploads to S3 with application/zip and then the download link through the browser causes them to be saved with a.zip extension. Previously Paperclip assigned the right content type ( application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) which is also what was sent to S3.
I can change the content_type after the file is assigned, but it's already been sent to S3 and that doesn't change the record on S3. If I change the content type before the file is assigned it ignores the setting because it's assigned. Is there anyway to enforce the content type value when it's known? In this case we are using internally generated files, so the files themselves are not tainted (there may be tainted data within the file but that's a completely separate issue). I'm unable to get this to work and so I'm stuck with pinning Paperclip at 3.2 (with the content spoofing vulnerability exposed).