From b9f6f9fc6fb29e0fcb6a348a3d10a104bca08546 Mon Sep 17 00:00:00 2001 From: Darya Romanchuk Date: Tue, 26 Mar 2024 16:47:34 +0300 Subject: [PATCH] Added filesize to X-File-Size param in header --- src/main/resources/assets/js/vera.results.js | 5 ++++- src/main/resources/assets/js/verapdf.js | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/resources/assets/js/vera.results.js b/src/main/resources/assets/js/vera.results.js index 12e229bf..78d26497 100644 --- a/src/main/resources/assets/js/vera.results.js +++ b/src/main/resources/assets/js/vera.results.js @@ -31,7 +31,7 @@ var pdfaValidator = { } }) }, - validate: function (formData, flavour, callback, contentType = "json") { + validate: function (formData, flavour, callback, contentType = "json", fileSize) { $.ajax({ url: '/api/validate/sha/' + flavour + '/', type: 'POST', @@ -39,6 +39,9 @@ var pdfaValidator = { dataType: contentType, contentType: false, processData: false, + headers: { + "X-File-Size": fileSize + }, success: function (data, textStatus, jqXHR) { pdfaValidator.result = jqXHR.responseText callback() diff --git a/src/main/resources/assets/js/verapdf.js b/src/main/resources/assets/js/verapdf.js index 319d7a25..4bce8da1 100644 --- a/src/main/resources/assets/js/verapdf.js +++ b/src/main/resources/assets/js/verapdf.js @@ -155,9 +155,10 @@ function callVeraPdfService () { $.when($('#results').empty()).then(addFileConfigurationToResult()); var spinHtml = $('#spinner-template').html() $('#results').html(spinHtml) + var selectedFile = $('#fileInput')[0].files[0]; pdfaValidator.validate(formData, flavour, function () { $.when(renderResult()).done(showDownloadBtn()); - }, outputFormat) + }, outputFormat, selectedFile.size) } function addFileConfigurationToResult () {