Skip to content

Commit

Permalink
Deprecate file preview based on data uri
Browse files Browse the repository at this point in the history
The file previww implementation could not work since the Content Security Policy has been improved deprecating the usage of data: uri and will need to be reimplemented on the base of the secure file viewer.

The benefits of such an implementation would consists in the possibility to implement preview for PDF and other types of files other than only images and to possibly show metadata to users / enable them to redact part of the file before of the upload.
  • Loading branch information
evilaliv3 committed Dec 13, 2023
1 parent 468be06 commit bfd4771
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 24 deletions.
10 changes: 0 additions & 10 deletions client/app/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -360,16 +360,6 @@ legend {
height: 12rem;
}

.imgPreview {
height: 10rem;
width: 10rem;
}

.imgPreview img {
height: 100%;
width: 100%;
}

.fileUpload {
position: absolute;
top: 0;
Expand Down
11 changes: 0 additions & 11 deletions client/app/js/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -868,17 +868,6 @@ factory("Utils", ["$rootScope", "$http", "$q", "$location", "$filter", "$timeout
return $location.path() === "/submission";
},

showFilePreview: function(content_type) {
var content_types = [
"image/gif",
"image/jpeg",
"image/png",
"image/bmp"
];

return content_types.indexOf(content_type) > -1;
},

moveUp: function(elem) {
elem[this.getYOrderProperty(elem)] -= 1;
},
Expand Down
3 changes: 0 additions & 3 deletions client/app/views/partials/wbfile_upload_status.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
<div class="row">
<div class="col-md-4">
<div class="filePreview">
<div class="imgPreview">
<img alt="preview picture" data-flow-img="file" data-ng-if="Utils.showFilePreview(file.file.type)" />
</div>
<div class="fileButtons">
<div data-ng-if="page === 'submissionpage' || !file.isComplete()" class="removeFileButton text-danger">
<div class="btn btn-sm btn-danger" data-ng-click="Utils.removeFile(submission, entry, uploads[fileinput].files, file)"><i class="fa-solid fa-times" aria-label="{'Remove' | translate}"></i></div>
Expand Down

0 comments on commit bfd4771

Please sign in to comment.