[Archive] Support for global paths in tizen.archive methods 98/270298/2
authorPiotr Kosko/Tizen API (PLT) /SRPOL/Engineer/Samsung Electronics <p.kosko@samsung.com>
Thu, 27 Jan 2022 19:04:25 +0000 (20:04 +0100)
committerPiotr Kosko/Tizen API (PLT) /SRPOL/Engineer/Samsung Electronics <p.kosko@samsung.com>
Mon, 7 Feb 2022 08:34:36 +0000 (09:34 +0100)
[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-286

[TCT] 5 failures - TCT need to be updated.

Change-Id: Ibdbf1c48468bb0648c2dd107cc2f42b506fe73df

src/archive/archive_api.js

index 9690bbb..8be82a0 100755 (executable)
@@ -274,15 +274,10 @@ function ArchiveFileEntry(data, priv) {
             ]),
             opId = getNextOpId();
 
-        if (!CommonFS.isVirtualPath(args.destinationDirectory)) {
-            throw new WebAPIException(
-                WebAPIException.TYPE_MISMATCH_ERR,
-                'Destination directory should be virtual path or file.'
-            );
-        }
+        var realDestinationPath = CommonFS.toRealPath(args.destinationDirectory);
 
         var callArgs = {
-            destinationDirectory: CommonFS.toRealPath(args.destinationDirectory),
+            destinationDirectory: realDestinationPath,
             stripName: args.stripName || null,
             overwrite: args.overwrite || null,
             opId: opId,
@@ -379,12 +374,7 @@ function ArchiveFile(data) {
             ]),
             opId = getNextOpId();
 
-        if (!CommonFS.isVirtualPath(args.sourceFile)) {
-            throw new WebAPIException(
-                WebAPIException.TYPE_MISMATCH_ERR,
-                'sourceFile should be virtual path or file.'
-            );
-        }
+        var realSourcePath = CommonFS.toRealPath(args.sourceFile);
 
         var optionsAttributes = [
                 'destination',
@@ -402,7 +392,7 @@ function ArchiveFile(data) {
         checkMode(this.mode, ['w', 'rw', 'a']);
 
         var callArgs = {
-            sourceFile: CommonFS.toRealPath(args.sourceFile),
+            sourceFile: realSourcePath,
             options: options,
             opId: opId,
             handle: getHandle()
@@ -462,17 +452,12 @@ function ArchiveFile(data) {
             ]),
             opId = getNextOpId();
 
-        if (!CommonFS.isVirtualPath(args.destinationDirectory)) {
-            throw new WebAPIException(
-                WebAPIException.TYPE_MISMATCH_ERR,
-                'destinationDirectory should be virtual path or file.'
-            );
-        }
+        var realDestinationPath = CommonFS.toRealPath(args.destinationDirectory);
 
         checkMode(this.mode, ['r', 'rw']);
 
         var callArgs = {
-            destinationDirectory: CommonFS.toRealPath(args.destinationDirectory),
+            destinationDirectory: realDestinationPath,
             overwrite: args.overwrite || null,
             opId: opId,
             handle: getHandle()
@@ -616,15 +601,10 @@ ArchiveManager.prototype.open = function() {
         }
     }
 
-    if (!CommonFS.isVirtualPath(args.file)) {
-        throw new WebAPIException(
-            WebAPIException.TYPE_MISMATCH_ERR,
-            'file should be virtual path or file.'
-        );
-    }
+    var realPath = CommonFS.toRealPath(args.file);
 
     var callArgs = {
-        file: CommonFS.toRealPath(args.file),
+        file: realPath,
         mode: args.mode,
         options: options,
         opId: opId