Skip to content

Commit 411e183

Browse files
authored
fix(unzip): replace UserException with ValueError exception in _extract() (aws#8599)
* fix(test): __extract() to use ValueError exception * move git ignore line
1 parent 75bc6c4 commit 411e183

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ cov.xml
407407
coverage.xml
408408

409409
# Temporary scratch directory used by the tests
410+
tests/integration/*/tmp/*
410411
tests/integration/buildcmd/scratch
411412
tests/integration/testdata/buildcmd/Dotnet*/bin
412413
tests/integration/testdata/buildcmd/Dotnet*/obj
@@ -425,4 +426,4 @@ samcli/lib/init/templates/cookiecutter-aws-sam-hello-java-gradle/**/.gradle/
425426
mise.toml
426427

427428
# Durable executions
428-
**/.durable-executions-local/
429+
**/.durable-executions-local/

samcli/local/lambdafn/zip.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
import os
88
import zipfile
99

10-
from samcli.commands.exceptions import UserException
11-
1210
LOG = logging.getLogger(__name__)
1311

1412
S_IFLNK = 0xA
@@ -69,7 +67,7 @@ def _extract(file_info, output_dir, zip_ref):
6967
link_name_abs = os.path.abspath(link_name)
7068

7169
if not link_name_abs.startswith(output_dir_abs + os.sep) and link_name_abs != output_dir_abs:
72-
raise UserException(f"Failed to extract file from the zip file. The '{file_info.filename}' is invalid")
70+
raise ValueError(f"Failed to extract file from the zip file. The '{file_info.filename}' is invalid")
7371

7472
# make leading dirs if needed
7573
leading_dirs = os.path.dirname(link_name)

0 commit comments

Comments
 (0)