New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a bug with the definition of the size of the encrypted file #1

Open
wants to merge 3 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@mgrachev

mgrachev commented Mar 20, 2014

No description provided.

@ankit8898

This comment has been minimized.

Owner

ankit8898 commented Mar 20, 2014

@mgrachev thanks for this pull. Can you let me know about the bug ?

@mgrachev

This comment has been minimized.

mgrachev commented Mar 20, 2014

The problem in the method CarrierWave:: SanitizedFile#size
I added an additional condition in this method:

if exists?
  File.size(path)
elsif defined? Carrierwave::EncrypterDecrypter
  File.size(path + '.enc') rescue 0
else
  0
end
@mgrachev

This comment has been minimized.

mgrachev commented Mar 24, 2014

As well have a problem with decoding files with Cyrillic names:


No such file or directory - /Users/mgrachev/Development/Rails/project_name/uploads/upload/attach/65/%D0%A4%D0%B0%D0%B9%D0%BB%20%D0%B4%D0%BB%D1%8F%20%D1%82%D0%B5%D1%81%D1%82%D0%BE%D0%B2.png.enc


Сheck in the console (rails console):

➜ dir = '/Users/mgrachev/Development/Rails/project_name/uploads/upload/attach/65/'
=> "/Users/mgrachev/Development/Rails/project_name/uploads/upload/attach/65/"

➜ file = '%D0%A4%D0%B0%D0%B9%D0%BB%20%D0%B4%D0%BB%D1%8F%20%D1%82%D0%B5%D1%81%D1%82%D0%BE%D0%B2.png.enc'
=> "%D0%A4%D0%B0%D0%B9%D0%BB%20%D0%B4%D0%BB%D1%8F%20%D1%82%D0%B5%D1%81%D1%82%D0%BE%D0%B2.png.enc"

➜ File.exists? dir + file
=> false

➜ unescaped_file = URI.unescape(file)
=> "Файл для тестов.png.enc"

➜ File.exists? dir + unescaped_file
=> true
@mgrachev

This comment has been minimized.

mgrachev commented Apr 9, 2014

As well fixed bug with deleting an encrypted file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment