Add basename and fix extension value for fog file #2587
Merged
+113
−52
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
About this PR
Make
basename
andextension
ofCarrierWave::SanitizedFile
andCarrierWave::Storage::Fog::File
the sameMy code
document.file.file.extension
document.file.file.basename
It works fine in
development
environment, but I have problem inproduction
.After checking, I got the result as below.
I think we shouldn't return different values in different environments for the same function.
Actual results
when file has complicated extensions , ex:
complex.filename.tar.gz
config.storage :file
config.storage :fog
when file has simple extension, ex:
simple.extension
config.storage :fog
when file has no extension, ex:
filename
config.storage :file
config.storage :fog
Expected results
when file has complicated extensions , ex:
complex.filename.tar.gz
complex.filename
tar.gz
when file has simple extension, ex:
simple.extension
simple
extension
when file has no extension, ex:
filename
filename
""