From 6e660681b88db1f02f7775ef4d38eb3d53e9b338 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Mon, 21 Dec 2015 16:01:12 +0000 Subject: [PATCH] Handle empty documents --- app/js/services.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/js/services.js b/app/js/services.js index 60279635..e104129e 100755 --- a/app/js/services.js +++ b/app/js/services.js @@ -1960,7 +1960,13 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) break; } }); - apiDoc.file_name = apiDoc.file_name || ''; + + apiDoc.mime_type = apiDoc.mime_type || ''; + apiDoc.file_name = apiDoc.file_name || 'file'; + if (apiDoc._ == 'documentEmpty') { + apiDoc.file_name = 'DELETED'; + apiDoc.size = 0; + } }; function getDoc (docID) { @@ -2063,6 +2069,10 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) file_name: doc.file_name }; + if (doc._ == 'documentEmpty') { + return $q.reject(); + } + if (historyDoc.downloaded && !toFileEntry) { var cachedBlob = MtpApiFileManager.getCachedFile(inputFileLocation); if (cachedBlob) {