Skip to content

Commit

Permalink
adds error message to frontend if try to upload anything other than x…
Browse files Browse the repository at this point in the history
…ml, dat, jpg, or zip to the dropzone. also allows xml upload via dropzone independently from dat, previously you had to upload together or it would be generated automatically
  • Loading branch information
benptc committed Apr 14, 2020
1 parent 7a9a7e7 commit 90f36e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion libraries/webInterface/gui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,7 @@ realityServer.gotClick = function (event) {

realityServer.myTargetDropzone.on('error', function(file, message) {
if (typeof message.error !== 'undefined') {
showErrorNotification(message.error);
showErrorNotification(message.error, 10000); // show for 10 seconds
}
});
} else {
Expand Down
10 changes: 7 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4295,7 +4295,7 @@ function objectWebServer() {
console.log('targetUpload', req.params.id);
var fileExtension = getFileExtension(filename);

if (fileExtension === 'jpg' || fileExtension === 'dat') {
if (fileExtension === 'jpg' || fileExtension === 'dat' || fileExtension === 'xml') {
if (!fs.existsSync(folderD + '/' + identityFolderName + '/target/')) {
fs.mkdirSync(folderD + '/' + identityFolderName + '/target/', '0766', function (err) {
if (err) {
Expand Down Expand Up @@ -4547,8 +4547,12 @@ function objectWebServer() {
console.log('could not unzip file');
}
} else {
res.status(200);
res.send('done');
let errorString = 'File type is not recognized target data. ' +
'You uploaded .' + fileExtension + ' but only ' +
'.dat, .jpg, .xml, and .zip are supported.';
res.status(400).send({
error: errorString
});
}

} else {
Expand Down

0 comments on commit 90f36e7

Please sign in to comment.