{"action":"created","issue":{"url":"https://api.github.com/repos/carrierwaveuploader/carrierwave/issues/1885","repository_url":"https://api.github.com/repos/carrierwaveuploader/carrierwave","labels_url":"https://api.github.com/repos/carrierwaveuploader/carrierwave/issues/1885/labels{/name}","comments_url":"https://api.github.com/repos/carrierwaveuploader/carrierwave/issues/1885/comments","events_url":"https://api.github.com/repos/carrierwaveuploader/carrierwave/issues/1885/events","html_url":"https://github.com/carrierwaveuploader/carrierwave/issues/1885","id":136085998,"number":1885,"title":"Overriding filename causes empty Uploader to think file exists","user":{"login":"gabrielrotbart","id":343879,"avatar_url":"https://avatars.githubusercontent.com/u/343879?v=3","gravatar_id":"","url":"https://api.github.com/users/gabrielrotbart","html_url":"https://github.com/gabrielrotbart","followers_url":"https://api.github.com/users/gabrielrotbart/followers","following_url":"https://api.github.com/users/gabrielrotbart/following{/other_user}","gists_url":"https://api.github.com/users/gabrielrotbart/gists{/gist_id}","starred_url":"https://api.github.com/users/gabrielrotbart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabrielrotbart/subscriptions","organizations_url":"https://api.github.com/users/gabrielrotbart/orgs","repos_url":"https://api.github.com/users/gabrielrotbart/repos","events_url":"https://api.github.com/users/gabrielrotbart/events{/privacy}","received_events_url":"https://api.github.com/users/gabrielrotbart/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-24T15:00:18Z","updated_at":"2016-02-25T05:18:04Z","closed_at":null,"body":"1. Override filename in uploader (e.g. ImageUploader)\r\n\r\n    ```\r\n    def filename\r\n      \"call_file_this.png\"\r\n    end\r\n    ```\r\n\r\n2. POST without selecting an image, which will result in a nil for the [\"image\"] param.\r\ne.g. Rails:\r\n`params[\"image\"].nil?` #=> true\r\n  \r\nAn ImageUploader image with all the correct attributes for a file will be created.\r\n\r\n`image.url` will contain \"call_this_file.png\"\r\n`image.current_path` will contain \"call_this_file.png\"\r\netc\r\n\r\nHowever, `image.exists?` will be false and `default_url` will not be called. This will result is rendering broken images.\r\n"},"comment":{"url":"https://api.github.com/repos/carrierwaveuploader/carrierwave/issues/comments/188618612","html_url":"https://github.com/carrierwaveuploader/carrierwave/issues/1885#issuecomment-188618612","issue_url":"https://api.github.com/repos/carrierwaveuploader/carrierwave/issues/1885","id":188618612,"user":{"login":"thomasfedb","id":193831,"avatar_url":"https://avatars.githubusercontent.com/u/193831?v=3","gravatar_id":"","url":"https://api.github.com/users/thomasfedb","html_url":"https://github.com/thomasfedb","followers_url":"https://api.github.com/users/thomasfedb/followers","following_url":"https://api.github.com/users/thomasfedb/following{/other_user}","gists_url":"https://api.github.com/users/thomasfedb/gists{/gist_id}","starred_url":"https://api.github.com/users/thomasfedb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomasfedb/subscriptions","organizations_url":"https://api.github.com/users/thomasfedb/orgs","repos_url":"https://api.github.com/users/thomasfedb/repos","events_url":"https://api.github.com/users/thomasfedb/events{/privacy}","received_events_url":"https://api.github.com/users/thomasfedb/received_events","type":"User","site_admin":false},"created_at":"2016-02-25T05:18:04Z","updated_at":"2016-02-25T05:18:04Z","body":"See the following example from the README:\r\n\r\n```\r\ndef filename\r\n  super.chomp(File.extname(super)) + '.png' if original_filename.present?\r\nend\r\n```"}}