mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-15 09:31:43 +00:00
no perder el nombre del thumbnail
This commit is contained in:
parent
8718d1ef96
commit
f72f1670d9
1 changed files with 3 additions and 2 deletions
|
@ -45,8 +45,9 @@ class Post::ImageUploader < CarrierWave::Uploader::Base
|
|||
# XXX los nombres de los archivos siempre son únicos, no chequeamos si
|
||||
# están repetidos.
|
||||
def filename
|
||||
@unique_filename ||= if /\A[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\..*\Z/ =~ file.try(:filename)
|
||||
file.try(:filename)
|
||||
current_filename = parent_version.try(:filename) || file.try(:filename)
|
||||
@unique_filename ||= if /\A(thumb_)?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\..*\Z/ =~ current_filename
|
||||
current_filename
|
||||
else
|
||||
[SecureRandom.uuid, '.', file.extension].join
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue