fix: ignore system files on import (#12526)

This commit is contained in:
Beto Dealmeida
2021-01-15 15:53:55 -08:00
committed by GitHub
parent 192832c262
commit 7bef5ab4d2
5 changed files with 17 additions and 21 deletions

View File

@@ -29,7 +29,7 @@ from sqlalchemy.exc import NoSuchTableError, OperationalError, SQLAlchemyError
from superset import event_logger
from superset.commands.exceptions import CommandInvalidError
from superset.commands.importers.v1.utils import remove_root
from superset.commands.importers.v1.utils import get_contents_from_bundle
from superset.constants import MODEL_API_RW_METHOD_PERMISSION_MAP, RouteMethod
from superset.databases.commands.create import CreateDatabaseCommand
from superset.databases.commands.delete import DeleteDatabaseCommand
@@ -778,10 +778,7 @@ class DatabaseRestApi(BaseSupersetModelRestApi):
if not upload:
return self.response_400()
with ZipFile(upload) as bundle:
contents = {
remove_root(file_name): bundle.read(file_name).decode()
for file_name in bundle.namelist()
}
contents = get_contents_from_bundle(bundle)
passwords = (
json.loads(request.form["passwords"])