-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Fixed case when file is not present on cloud #2173
Conversation
@@ -182,6 +182,7 @@ def custom_method | |||
tempfile.read | |||
tempfile.close | |||
end | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
Added test on copy_to_local
@@ -170,6 +170,7 @@ def copy_to_local_file(style, local_dest_path) | |||
log("copying #{path(style)} to local file #{local_dest_path}") | |||
::File.open(local_dest_path, 'wb') do |local_file| | |||
file = directory.files.get(path(style)) | |||
return false unless file | |||
local_file.write(file.body) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd write this as:
if file = directory.files.get(path(style))
local_file.write file.body
end
Do you think it reads better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tute Usually we avoid assignment in conditionals as it always triggers internal question whether this line is typo or not. I.e. it requires check of surrounding of the line, which is sometimes ok.
I.e. I can change this line if you wish so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tute Usually we avoid assignment in conditionals as it always triggers internal question whether this line is typo or not. I.e. it requires check of surrounding of the line, which is sometimes ok.
I.e. I can change this line if you wish so.
I don't feel very strongly either way, so following the Hound (who didn't bark at this line) is good with me. 👍
This looks good to me. What was the behaviour before your fix? What is it now? Can you add that information to your commit message? Then we'll merge. Thanks! |
@tute Currently it fails with NoMethodError on nil when file is not there. And since |
Great! Can you please squash your commit together, rebase against latest master, and add this context to the commit message? Thanks! |
Did it myself, and pushed to master. Thank you! 🎉 |
No description provided.