[Cordova-File] Synchronously checking access to file 66/169966/3
authorSzymon Jastrzebski <s.jastrzebsk@partner.samsung.com>
Mon, 12 Feb 2018 10:02:37 +0000 (11:02 +0100)
committerSzymon Jastrzebski <s.jastrzebsk@partner.samsung.com>
Tue, 20 Feb 2018 14:51:04 +0000 (14:51 +0000)
Adding FileError.SECURITY_ERROR to errorCallbacks.
The change is needed because of file access checking, which is implemented
in Tizen 5.0

Change-Id: Ic2a40fd4c92ed045e506344443ee295d1527d56f
Signed-off-by: Szymon Jastrzebski <s.jastrzebsk@partner.samsung.com>
src/lib/plugins/cordova-plugin-file/tizen/Errors.js
src/lib/plugins/cordova-plugin-file/tizen/resolveLocalFileSystemURI.js

index c31ff4c..6c61ed3 100644 (file)
@@ -34,6 +34,9 @@ function convertTizenFileError(err) {
     case 'IOError':
       return FileError.INVALID_MODIFICATION_ERR;
 
+    case 'SecurityError':
+      return FileError.SECURITY_ERR;
+
     default:
       return FileError.ENCODING_ERR;
   }
index 8ad212d..0971ded 100644 (file)
@@ -45,7 +45,11 @@ module.exports = {
       errorCallback && errorCallback(convertTizenFileError(error));
     }
 
-    tizen.filesystem.resolve(path, onResolve, onError, 'r');
+    try {
+      tizen.filesystem.resolve(path, onResolve, onError, 'r');
+    } catch (e) {
+      onError(e);
+    }
   },
   _getLocalFilesystemPath: function(successCallback, errorCallback, args) {
     var path = rootUtils.internalUrlToNativePath(args[0]);