From 5eb0e42312a7f390157c5721bba250a4c892c0b0 Mon Sep 17 00:00:00 2001
From: Alexandre Boeglin <alex@nexedi.com>
Date: Tue, 17 Jan 2006 17:46:56 +0000
Subject: [PATCH] bugfix in tgz import: handle file path starting with "./"

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5146 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/BusinessTemplate.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py
index 0d7a251452..3b25fe7e80 100755
--- a/product/ERP5/Document/BusinessTemplate.py
+++ b/product/ERP5/Document/BusinessTemplate.py
@@ -230,7 +230,9 @@ class BusinessTemplateTarball(BusinessTemplateArchive):
       if class_name in info.name.split('/'):
         if info.isreg():
           file = tar.extractfile(info)
-          folders = string.split(info.name, os.sep)
+          tar_file_name = info.name.startswith('./') and info.name[2:] or \
+              info.name
+          folders = string.split(tar_file_name, os.sep)
           file_name = (os.sep).join(folders[2:])
           if '%' in file_name:
             file_name = url2pathname(file_name)
-- 
2.30.9