Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions app/fng-jq-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,11 @@

$scope.$on('fileuploaddone', function (event, data) {
const field = $scope.dataField(true);
// $scope.dataField(true) should always return something, but have seen a case in Sentry where it did not.
// surely a very rare case where they cancelled / redirected etc. at a very inopportune moment
if (!field) {
return;
}
const fileDetails = data.result.files[0];
const _id = fileDetails.id;
const filename = fileDetails.name;
Expand All @@ -327,9 +332,11 @@
// urls for downloading, deleting and retrieving a thumbnail for this item as setUpAttachments() isn't
// called again here
const queue = $scope.$$childHead.queue;
addAttachmentUrls(queue[queue.length - 1], location, _id, filename, thumbnailId);
$scope.ngModel.$setDirty();
assignQueueToFormScope();
if (queue) {
addAttachmentUrls(queue[queue.length - 1], location, _id, filename, thumbnailId);
$scope.ngModel.$setDirty();
assignQueueToFormScope();
}
});
},
])
Expand Down
15 changes: 11 additions & 4 deletions dist/fng-jq-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,11 @@

$scope.$on('fileuploaddone', function (event, data) {
const field = $scope.dataField(true);
// $scope.dataField(true) should always return something, but have seen a case in Sentry where it did not.
// surely a very rare case where they cancelled / redirected etc. at a very inopportune moment
if (!field) {
return;
}
const fileDetails = data.result.files[0];
const _id = fileDetails.id;
const filename = fileDetails.name;
Expand All @@ -327,11 +332,13 @@
// urls for downloading, deleting and retrieving a thumbnail for this item as setUpAttachments() isn't
// called again here
const queue = $scope.$$childHead.queue;
addAttachmentUrls(queue[queue.length - 1], location, _id, filename, thumbnailId);
$scope.ngModel.$setDirty();
assignQueueToFormScope();
if (queue) {
addAttachmentUrls(queue[queue.length - 1], location, _id, filename, thumbnailId);
$scope.ngModel.$setDirty();
assignQueueToFormScope();
}
});
},
}
])
.directive('fngJqUploadForm', [
'PluginHelperService',
Expand Down
Loading
Loading