From 2261df127c970929bfc73eb2e6c11e8cdf6dd88e Mon Sep 17 00:00:00 2001 From: Szymon Jastrzebski Date: Mon, 12 Feb 2018 11:02:37 +0100 Subject: [PATCH] [Cordova-File] Synchronously checking access to file 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 --- src/lib/plugins/cordova-plugin-file/tizen/Errors.js | 3 +++ .../plugins/cordova-plugin-file/tizen/resolveLocalFileSystemURI.js | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/plugins/cordova-plugin-file/tizen/Errors.js b/src/lib/plugins/cordova-plugin-file/tizen/Errors.js index c31ff4c..6c61ed3 100644 --- a/src/lib/plugins/cordova-plugin-file/tizen/Errors.js +++ b/src/lib/plugins/cordova-plugin-file/tizen/Errors.js @@ -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; } diff --git a/src/lib/plugins/cordova-plugin-file/tizen/resolveLocalFileSystemURI.js b/src/lib/plugins/cordova-plugin-file/tizen/resolveLocalFileSystemURI.js index 8ad212d..0971ded 100644 --- a/src/lib/plugins/cordova-plugin-file/tizen/resolveLocalFileSystemURI.js +++ b/src/lib/plugins/cordova-plugin-file/tizen/resolveLocalFileSystemURI.js @@ -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]); -- 2.7.4