Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Use 'X-CSRF-Token' in favor of deprecated 'X-Query-Params'

  • Loading branch information...
commit 9189836b0e1cc8b5f88f45c803488ed1d92cf59c 1 parent 4bcb614
Josh Steiner jsteiner authored

Showing 1 changed file with 1 addition and 9 deletions. Show diff stats Hide diff stats

  1. +1 9 lib/assets/javascripts/jack_up/file_uploader.coffee
10 lib/assets/javascripts/jack_up/file_uploader.coffee
... ... @@ -1,11 +1,3 @@
1   -railsCSRFData = ->
2   - csrfParam = $('meta[name=csrf-param]').attr('content')
3   - csrfToken = $('meta[name=csrf-token]').attr('content')
4   -
5   - formData = {}
6   - formData[csrfParam] = csrfToken
7   - JSON.stringify formData
8   -
9 1 class @JackUp.FileUploader
10 2 constructor: (@options) ->
11 3 @path = @options.path
@@ -49,7 +41,7 @@ class @JackUp.FileUploader
49 41
50 42 xhr.setRequestHeader 'Content-Type', file.type
51 43 xhr.setRequestHeader 'X-File-Name', file.name
52   - xhr.setRequestHeader 'X-Query-Params', railsCSRFData()
  44 + xhr.setRequestHeader 'X-CSRF-Token', $('meta[name=csrf-token]').attr('content')
53 45
54 46 @trigger 'upload:start', file: file
55 47 xhr.send file

0 comments on commit 9189836

Please sign in to comment.
Something went wrong with that request. Please try again.