Skip to content
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

Sinatra apps without views: NoMethodError #96

Open
bashcoder opened this issue Nov 12, 2014 · 1 comment
Open

Sinatra apps without views: NoMethodError #96

bashcoder opened this issue Nov 12, 2014 · 1 comment
Assignees

Comments

@bashcoder
Copy link
Contributor

If a Sinatra app doesn't have a views/ folder, the method detect_views() returns nil instead of an empty array, unlike the other detect_*() methods in sinatra.rb.

https://github.com/codesake/codesake-dawn/blob/master/lib/codesake/dawn/sinatra.rb#L119

This causes a NoMethodError on line 37, which expects a valid @views array.

gems/codesake-dawn-1.2.0/lib/codesake/dawn/sinatra.rb:37:in `detect_reflected_xss': undefined method `each' for nil:NilClass (NoMethodError)

The simplest solution that doesn't require adding conditionals (or complicating existing ones) is simply to add a default empty array to the end of detect_views() on line 120.

@bashcoder
Copy link
Contributor Author

This PR is a simpler approach to what was proposed in #95, and makes the interface consistent across all of the detect_*() methods.

@thesp0nge thesp0nge modified the milestone: Version 1.5.0 - Tow Mater Nov 18, 2015
@thesp0nge thesp0nge self-assigned this Nov 19, 2015
@thesp0nge thesp0nge modified the milestones: v1-5-0, v1-5-5 Dec 3, 2015
@thesp0nge thesp0nge removed this from the v1-7-0 milestone Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants