From 2c9e3dfacaeb9c2092c81d74aec95905f81db296 Mon Sep 17 00:00:00 2001
From: "lixuefeng (Cloud)"
Date: Sat, 25 May 2019 18:12:40 +0800
Subject: [PATCH] check if absolute path when add target into repo
Signed-off-by: lixuefeng (Cloud)
---
tuf/scripts/repo.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tuf/scripts/repo.py b/tuf/scripts/repo.py
index 6689a42b98..a769914816 100755
--- a/tuf/scripts/repo.py
+++ b/tuf/scripts/repo.py
@@ -701,7 +701,10 @@ def add_target_to_repo(parsed_arguments, target_path, repo_targets_path,
if not os.path.exists(target_path):
logger.debug(repr(target_path) + ' does not exist. Skipping.')
-
+
+ elif os.path.isabs(target_path):
+ logger.warn('omit this file:' + target_path + ', the target '
+ 'file should be in ' + parsed_arguments.path)
else:
securesystemslib.util.ensure_parent_dir(
os.path.join(repo_targets_path, target_path))