{"action":"opened","issue":{"url":"https://api.github.com/repos/janko-m/shrine/issues/52","repository_url":"https://api.github.com/repos/janko-m/shrine","labels_url":"https://api.github.com/repos/janko-m/shrine/issues/52/labels{/name}","comments_url":"https://api.github.com/repos/janko-m/shrine/issues/52/comments","events_url":"https://api.github.com/repos/janko-m/shrine/issues/52/events","html_url":"https://github.com/janko-m/shrine/issues/52","id":141515992,"number":52,"title":"PDF upload corrupted","user":{"login":"xevix","id":510743,"avatar_url":"https://avatars.githubusercontent.com/u/510743?v=3","gravatar_id":"","url":"https://api.github.com/users/xevix","html_url":"https://github.com/xevix","followers_url":"https://api.github.com/users/xevix/followers","following_url":"https://api.github.com/users/xevix/following{/other_user}","gists_url":"https://api.github.com/users/xevix/gists{/gist_id}","starred_url":"https://api.github.com/users/xevix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xevix/subscriptions","organizations_url":"https://api.github.com/users/xevix/orgs","repos_url":"https://api.github.com/users/xevix/repos","events_url":"https://api.github.com/users/xevix/events{/privacy}","received_events_url":"https://api.github.com/users/xevix/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-03-17T08:42:06Z","updated_at":"2016-03-17T08:42:06Z","closed_at":null,"body":"Using Rails 4 and the ActiveRecord Shrine plugin, there seems to be file corruption in PDF uploads.\r\n\r\nAt some point between being a Rack file coming into Rails and the `process` method being called, the copy made by Shrine into the cache is being corrupted consistently.\r\n\r\n```bash\r\n# Original\r\n$ ll /tmp/*.pdf\r\n-rw-------. 1 foo bar 2520603 Mar 17 16:28 /tmp/RackMultipart20160317-60267-1082pik.pdf\r\n\r\n# Shrine's Cache\r\n$ ll /project/public/uploads/cache/\r\n... snip ...\r\n-rw-r--r--. 1 501 foo 2520347 Mar 17 16:28 27f745231e058660d965d47bfe44fce7eb30a2c96e837227d4917567f1d1.pdf\r\n... snip ...\r\n```\r\n**Filesizes**\r\n\r\nOriginal: 2520603\r\nShrine:   2520347\r\n\r\nI've had a bit of trouble following the stacktrace to see at what exact point the `io` param of `process` copies the original Rack file to see what could be causing this, so if you know where please let me know and I can keep hunting. Thanks.\r\n\r\nFile used: https://www.gnu.org/software/emacs/manual/pdf/emacs.pdf"}}