+ if ($scope.editFile && !file.external) {
+ $scope.editFile.link = '';
+ }
+ $scope.editFile = false;
+ events.emit('success', trans('entities.attachments_updated_success'));
+ }, checkError('edit'));
+ };
+
+ /**
+ * Get the url of a file.
+ */
+ $scope.getFileUrl = function(file) {
+ return window.baseUrl('/attachments/' + file.id);
+ };
+
+ /**
+ * Search the local files via another file object.
+ * Used to search via object copies.
+ * @param file
+ * @returns int
+ */
+ function filesIndexOf(file) {
+ for (let i = 0; i < $scope.files.length; i++) {
+ if ($scope.files[i].id == file.id) return i;
+ }
+ return -1;
+ }