Actions
Defect #42839
closedDownloading .js files from the repository browser fails with a 422 error due to ActionController::InvalidCrossOriginRequest
Resolution:
Fixed
Affected version:
Description
To recreate, find a .js file, click the download in the top right

ActionController::InvalidCrossOriginRequest (Security warning: an embedded <script> tag on another site requested protected JavaScript. If you know what you're doing, go ahead and disable forgery protection on this action to permit cross-origin JavaScript embedding.): actionpack (7.2.2.1) lib/action_controller/metal/request_forgery_protection.rb:432:in `verify_same_origin_request'
Files
Related issues
Updated by Go MAEDA 11 months ago
- File 42839.patch 42839.patch added
- Target version set to Candidate for next minor release
The ActionController::InvalidCrossOriginRequest exception can be avoided by serving JavaScript files with the content type application/octet-stream instead of application/javascript. The attached patch fixes the reported issue by setting the content type appropriately.
Updated by Go MAEDA 11 months ago
- File 42839-v2.patch 42839-v2.patch added
I have updated the patch to serve JavaScript files with the content type "text/plain", as it is more suitable than "application/octet-stream" for non-binary files.
Updated by Go MAEDA 10 months ago
- Subject changed from Attempting to download a js file from SCM gives a 422 error with InvalidCrossOriginRequest in the log to Downloading .js files from the repository browser fails with a 422 error due to ActionController::InvalidCrossOriginRequest
- Status changed from Confirmed to Resolved
- Assignee set to Go MAEDA
- Resolution set to Fixed
Committed the fix in r23857. Thank you for reporting the issue.
Updated by Massimo Rossello 10 months ago
Version 5.1.9's subversion repository does not contain foo.js, thus the new test fails
Updated by Go MAEDA 10 months ago
- Related to Defect #43002: RepositoriesSubversionControllerTest fails in 5.1-stable due to missing foo.js in test repository added
Actions