[Filesystem] Report NotFound error if virtual root is invalid.
authorPawel Andruszkiewicz <p.andruszkie@samsung.com>
Wed, 29 Jul 2015 09:43:01 +0000 (11:43 +0200)
committerPawel Andruszkiewicz <p.andruszkie@samsung.com>
Wed, 29 Jul 2015 09:43:11 +0000 (11:43 +0200)
Fixes: UTC_filesystem_resolve_invalid_pram_location_N_003
[Verification] [Verification] Wearable service UTC: 94/94
               Mobile TCT: 289/289

Change-Id: I16f8e450eefbc6389591c3e08b1d1b478f65faa1
Signed-off-by: Pawel Andruszkiewicz <p.andruszkie@samsung.com>
src/filesystem/js/file_system_manager.js

index 161a51f97ceaa9e9082d9300a83be972b828948e..e5e3c8b8bc1a68db2bdb21242087b2a9301d462a 100755 (executable)
@@ -65,6 +65,17 @@ FileSystemManager.prototype.resolve = function(location, onsuccess, onerror, mod
   }
 
   var _realPath = commonFS_.toRealPath(args.location);
+
+  if (!_realPath) {
+    // invalid real path means that virtual root does not exist
+    setTimeout(function() {
+      native_.callIfPossible(args.onerror,
+          new WebAPIException(WebAPIException.NOT_FOUND_ERR,
+          'Specified virtual root does not exist.'));
+    }, 0);
+    return;
+  }
+
   var _isLocationAllowed = commonFS_.isLocationAllowed(_realPath);
 
   if (args.mode !== 'r' && !_isLocationAllowed) {