Skip to content
New issue

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

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

Already on GitHub? # to your account

Test failure after upgrading from 1.2.3 to 1.3.0 #2361

Closed
tbr00 opened this issue Dec 24, 2018 · 2 comments
Closed

Test failure after upgrading from 1.2.3 to 1.3.0 #2361

tbr00 opened this issue Dec 24, 2018 · 2 comments

Comments

@tbr00
Copy link

tbr00 commented Dec 24, 2018

After upgrading from 1.2.3 to 1.3.0 I have failing tests. The problem is when rendering a form which attempts to display the filename of an uploaded file. I get the error:

ActionView::Template::Error: ActionView::Template::Error: undefined method url' for class NilClass'

reported on the code:
<%= a.object.filename.to_s.split('/').last %>

As I have no 'url' method I turned on a full trace and find the error actually comes from line 502 in fog.rb in:

    def url_options_supported?(local_file)
      parameters = file.method(:url).parameters
      parameters.count == 2 && parameters[1].include?(:options)
    end

While I don't begin to understand what may be going on, this code does not seem to be in version 1.2.3 and it looks suspicious that the parameter 'local_file' is not actually used. Indeed blindly changing the code to:

parameters = local_file.method(:url).parameters

results in the test passing.
Perhaps someone who does understand could comment?

@mshibuya
Copy link
Member

Thanks for reporting, pushed a fix as 0b9a64a.

@stanhu
Copy link
Contributor

stanhu commented Jan 9, 2019

@tbr00 Thanks for fixing. This is indeed correct and saves an unnecessary HEAD request.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants