Expected Behavior:
If you are willing to add a specific filename to your attachment, or send in a specific content type for your file, you can use data: to attach the base64 data and specify your filename:, content_type: and/or identify: hash keys
Actual Behavior:
Identify Hash key doesn't identify the file extension automatically. Infact the extension is not recognized when uploading a valid base 64 URI.
Steps to Reproduce:
Create a model with a field for attachment
Pass a base64 data URI to file attachment and save it. Pass only the base 64 string in data, without filename and content_type parameters.
Check the filename and it does not have an extension. Filename will have the random generated time string but will lose the extension.
Create an executable test case: use the bug_report_template.rb as a starting point.
You can execute it by running ruby the_bug_report_filename.rb
Version of the repo:
Ruby and Rails Version:
Rails Stacktrace: this can be found in the log/development.log or log/test.log, if this is applicable.
I think a way for this might be to identify the extension from the file content_type using:
Bug report:
bug_report_template.rb
as a starting point. You can execute it by runningruby the_bug_report_filename.rb
log/development.log
orlog/test.log
, if this is applicable.I think a way for this might be to identify the extension from the file content_type using: