From e4eb319c21da033d8a4dba5f4f8a0cc56b98f3a2 Mon Sep 17 00:00:00 2001
From: "Piotr Kosko/Tizen API (PLT) /SRPOL/Engineer/Samsung Electronics"
Date: Thu, 27 Jan 2022 20:04:25 +0100
Subject: [PATCH] [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
---
src/archive/archive_api.js | 36 ++++++++----------------------------
1 file changed, 8 insertions(+), 28 deletions(-)
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
--
2.7.4