Skip to content

Commit e5e1a9f

Browse files
committed
Do not apply policies to attachments
Signed-off-by: Maxime Gervais <gervais.maxime@gmail.com>
1 parent 74215ef commit e5e1a9f

3 files changed

Lines changed: 25 additions & 4 deletions

File tree

Source/Common/Reports.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,9 @@ int Reports::create_report_ma_xml(int user, const std::vector<long>& files,
721721
if (core->checker_file_from_id(user, files[i], file, err) < 0)
722722
return -1;
723723

724+
if (file.rfind("attachment:", 0) == 0)
725+
continue;
726+
724727
xml_escape_attributes(file);
725728
report += "<media ref=\"" + file + "\">\n";
726729

Source/Resource/html/js/checker/cellPolicy.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,26 @@ var policyCell = (function() {
3737

3838
// Update cell if analysis of file is succeeded
3939
if ($(result.cell('#result-' + fileId, 5).node()).hasClass('success')) {
40-
if (policyId !== undefined && policyId !== "-1" && policyId !== -1) {
40+
if (policyId !== undefined && policyId !== "-1" && policyId !== -1 && result.$('#result-' + fileId).data('attachment') !== "true") {
4141
reset(fileId);
4242
addSpinnerToCell(fileId);
4343

4444
checkerAjax.policyStatus(fileId, policyId);
4545
}
46-
else {
46+
else if (result.$('#result-' + fileId).data('attachment') == "true") {
47+
empty(fileId)
48+
} else {
4749
emptyWithModal(fileId)
4850
}
4951
}
5052
};
5153

54+
var empty = function(fileId) {
55+
var nodePolicy = $(result.cell('#result-' + fileId, 2).node());
56+
nodePolicy.removeClass().addClass('info');
57+
result.cell('#result-' + fileId, 2).data('<div><span class="policyResult">N/A</span></div>');
58+
};
59+
5260
var emptyWithModal = function(fileId) {
5361
var nodePolicy = $(result.cell('#result-' + fileId, 2).node());
5462
nodePolicy.removeClass().addClass('info');
@@ -191,6 +199,7 @@ var policyCell = (function() {
191199
success: success,
192200
error: error,
193201
update: update,
202+
empty: empty,
194203
emptyWithModal: emptyWithModal,
195204
addSpinnerToCell: addSpinnerToCell,
196205
displayReport: displayReport,

Source/Resource/html/js/checker/table.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ var checkerTable = (function() {
111111
nodej.data('fileId', fileId);
112112

113113
// Add policy, display and verbosity
114+
if (fileName.startsWith("attachment:")) {
115+
nodej.data('attachment', "true");
116+
} else {
117+
nodej.data('attachment', "false");
118+
}
114119
nodej.data('policy', formValues.policy);
115120
nodej.data('policyName', formValues.policyText);
116121
nodej.data('display', formValues.display);
@@ -260,7 +265,7 @@ var checkerTable = (function() {
260265
statusCell.success(statusFileId);
261266

262267
// Implementation and Policy
263-
if (node.data('policy') != undefined && node.data('policy') !== "-1" && node.data('policy') !== -1) {
268+
if (node.data('policy') != undefined && node.data('policy') !== "-1" && node.data('policy') !== -1 && node.data('attachment') !== "true") {
264269
implementationCell.addSpinnerToCell(statusFileId);
265270
policyCell.addSpinnerToCell(statusFileId);
266271

@@ -272,7 +277,11 @@ var checkerTable = (function() {
272277

273278
reports.push({id: statusFileId, tool: status.tool});
274279

275-
policyCell.emptyWithModal(statusFileId);
280+
if (node.data('attachment') !== "true") {
281+
policyCell.emptyWithModal(statusFileId);
282+
} else {
283+
policyCell.empty(statusFileId);
284+
}
276285
}
277286

278287
// MediaInfo

0 commit comments

Comments
 (0)