From: Piotr Kosko/Tizen API (PLT) /SRPOL/Engineer/Samsung Electronics
Date: Thu, 27 Jan 2022 19:04:25 +0000 (+0100)
Subject: [Archive] Support for global paths in tizen.archive methods
X-Git-Tag: accepted/tizen/6.5/unified/20230621.125857~7
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e4eb319c21da033d8a4dba5f4f8a0cc56b98f3a2;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git
[Archive] Support for global paths in tizen.archive methods
[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-286
[TCT] 5 failures - TCT need to be updated.
Change-Id: Ibdbf1c48468bb0648c2dd107cc2f42b506fe73df
---
diff --git a/src/archive/archive_api.js b/src/archive/archive_api.js
index 9690bbb..8be82a0 100755
--- a/src/archive/archive_api.js
+++ b/src/archive/archive_api.js
@@ -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