Ensure we include the CSRF token when uploading files. Fixes #4350

This commit is contained in:
Murtuza Zabuawala 2019-06-12 13:52:18 +01:00 committed by Dave Page
parent 23364464c2
commit 08b78fb6a1
2 changed files with 7 additions and 1 deletions

View File

@ -25,4 +25,5 @@ Bug fixes
| `Bug #4317 <https://redmine.postgresql.org/issues/4317>`_ - Ensure that browser auto-fill doesn't cause Help pages to be opened unexpectedly.
| `Bug #4320 <https://redmine.postgresql.org/issues/4320>`_ - Fix issue where SSH tunnel connection using password is failing, it's regression of Master Password.
| `Bug #4329 <https://redmine.postgresql.org/issues/4329>`_ - Fix an initialisation error when two functions with parameters are debugged in parallel.
| `Bug #4343 <https://redmine.postgresql.org/issues/4343>`_ - Fix issue where property dialog of column should open properly for EPAS v12.
| `Bug #4343 <https://redmine.postgresql.org/issues/4343>`_ - Fix issue where property dialog of column should open properly for EPAS v12.
| `Bug #4350 <https://redmine.postgresql.org/issues/4350>`_ - Ensure we include the CSRF token when uploading files.

View File

@ -1466,9 +1466,14 @@ define([
'<a href="javascript:void(0);" class="fa fa-trash dz_file_remove" data-dz-remove></a>' +
'</div>';
// We need to append our csrf token with dropzone's ajax request header
let csrfToken = {};
csrfToken[pgAdmin.csrf_token_header] = pgAdmin.csrf_token;
$('div#multiple-uploads').dropzone({
paramName: 'newfile',
url: pgAdmin.FileUtils.fileConnector,
headers: csrfToken,
maxFilesize: fileSize,
maxFiles: config.upload.number,
addRemoveLinks: true,