Skip to content

Commit

Permalink
Fixed jquery-ujs vulnerbility issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Dev authored and Dev committed Jun 5, 2024
1 parent 83b041b commit ec211f5
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions src/rails.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,24 +212,8 @@

// Handles "data-method" on links such as:
// <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a>
handleMethod: function(link) {
var href = rails.href(link),
method = link.data('method'),
target = link.attr('target'),
csrfToken = rails.csrfToken(),
csrfParam = rails.csrfParam(),
form = $('<form method="post" action="' + href + '"></form>'),
metadataInput = '<input name="_method" value="' + method + '" type="hidden" />';

if (csrfParam !== undefined && csrfToken !== undefined && !rails.isCrossDomain(href)) {
metadataInput += '<input name="' + csrfParam + '" value="' + csrfToken + '" type="hidden" />';
}

if (target) { form.attr('target', target); }

form.hide().append(metadataInput).appendTo('body');
form.submit();
},
// Handles "data-method" on links such as:
// <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a>

// Helper function that returns form elements that match the specified CSS selector
// If form is actually a "form" element this will return associated elements outside the from that have
Expand Down

0 comments on commit ec211f5

Please sign in to comment.