-
Notifications
You must be signed in to change notification settings - Fork 4
Spring 26 Changes and GitHub autoinclude #36
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
Conversation
Update page.liquid .
✅ Deploy Preview for sustainableurbansystems ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
| content = nil | ||
| urls.each do |url| | ||
| begin | ||
| content = URI.open(url, "User-Agent" => "Jekyll").read |
Check failure
Code scanning / CodeQL
Use of `Kernel.open` or `IO.read` or similar sinks with a non-constant value Critical
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 2 days ago
In general, the fix is to avoid URI.open with a dynamic argument and instead either (a) construct a URI object explicitly and call open on it, which avoids the Kernel.open resolution that static analysis tools complain about, or (b) use a dedicated HTTP client (such as Net::HTTP) to fetch remote content. Both approaches make the intent explicit and avoid the ambiguous URI.open shortcut.
For this specific code, the minimal, behavior-preserving change is to replace URI.open(url, "User-Agent" => "Jekyll").read with URI(url).open("User-Agent" => "Jekyll").read. This continues to use open-uri (already required at the top of the file), preserves the custom User-Agent header, and keeps the same exception-handling behavior, while addressing the CodeQL complaint. No other parts of the file need to change, and no new imports are required because require 'open-uri' already brings in URI extensions.
Concretely, in _plugins/github-profile-readme.rb, inside fetch_readme(handle), change line 42 from content = URI.open(url, "User-Agent" => "Jekyll").read to content = URI(url).open("User-Agent" => "Jekyll").read. No additional methods, helper functions, or definitions are needed.
-
Copy modified line R42
| @@ -39,7 +39,7 @@ | ||
| content = nil | ||
| urls.each do |url| | ||
| begin | ||
| content = URI.open(url, "User-Agent" => "Jekyll").read | ||
| content = URI(url).open("User-Agent" => "Jekyll").read | ||
| break if content && !content.strip.empty? | ||
| rescue OpenURI::HTTPError, SocketError, Timeout::Error, Errno::ECONNRESET, | ||
| Errno::ETIMEDOUT, Errno::ECONNREFUSED, Errno::EHOSTUNREACH, |

No description provided.