Skip to content
This repository was archived by the owner on Jul 13, 2023. It is now read-only.

Fixed case when file is not present on cloud #2173

Closed
wants to merge 2 commits into from

Conversation

vimutter
Copy link
Contributor

No description provided.

@@ -182,6 +182,7 @@ def custom_method
tempfile.read
tempfile.close
end

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)
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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. 👍

@tute
Copy link
Contributor

tute commented Apr 15, 2016

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!

@vimutter
Copy link
Contributor Author

@tute Currently it fails with NoMethodError on nil when file is not there. And since nil is proper response from fog on missing files and this method already returns false if any error happen (see line 178) I decided that returning false here would be properly handled on client code.

@tute
Copy link
Contributor

tute commented Apr 23, 2016

Currently it fails with NoMethodError on nil when file is not there. And since nil is proper response from fog on missing files and this method already returns false if any error happen (see line 178) I decided that returning false here would be properly handled on client code.

Great! Can you please squash your commit together, rebase against latest master, and add this context to the commit message? Thanks!

@tute tute closed this in 511f3bc Apr 28, 2016
@tute
Copy link
Contributor

tute commented Apr 28, 2016

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! 🎉

@vimutter vimutter deleted the patch-1 branch November 7, 2016 09:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants