Fix jQuery version#1309
Open
fbacall wants to merge 2 commits into
Open
Conversation
Fix JS eval error when loading calendar
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Rails asset pipeline to load modern jQuery (via jquery-rails) and adjusts the events calendar AJAX loading to avoid CSP issues caused by executing returned JavaScript via eval.
Changes:
- Bump
jquery-railsto 4.6.1 and switch the asset manifest to requirejquery3(jQuery 3.7.1). - Change calendar loading to use jQuery’s built-in
dataType: 'script'execution instead ofeval. - Remove the explicit
.jsformat from the calendar URL so format negotiation can occur via the AJAX request.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Gemfile.lock | Bumps jquery-rails to 4.6.1. |
| app/views/events/index.html.erb | Adjusts calendar tab’s data-calendar URL to drop the explicit format: :js. |
| app/assets/javascripts/application.js | Loads jquery3 and updates calendar AJAX loading to avoid eval. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
|
probably should add test to check if calendar is available |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of changes
jquery-rails) instead of version 1.x.jquery-railsversionMotivation and context
Events calendar was not loading due to CSP violation caused by old jQuery trying to use
eval.Checklist