This commit is contained in:
Daniel Shafer 2026-10-13 14:17:46 +00:00 • committed by GitHub
commit 8463000159
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 1 deletions

View file

@ -649,7 +649,7 @@ CMD {cmd}""".format(
[f"ENV {key} '{value}'" for key, value in environment_variables.items()]
),
install_from=" ".join(install),
files=" ".join(files),
files=" ".join(shlex.quote(f) for f in files),
port=port,
cmd=cmd,
).strip()

View file

@ -59,3 +59,25 @@ def test_package_with_port(mock_call, mock_which, tmp_path_factory):
)
assert 0 == result.exit_code
assert EXPECTED_DOCKERFILE.format(port=8080) == capture.captured
@mock.patch("shutil.which")
@mock.patch("datasette.cli.call")
def test_package_filename_with_space(mock_call, mock_which, tmp_path_factory):
# https://github.com/simonw/datasette/issues/1233
mock_which.return_value = True
capture = CaptureDockerfile()
mock_call.side_effect = capture
runner = CliRunner()
os.chdir(tmp_path_factory.mktemp("runner"))
with open("extra database.db", "w") as fp:
fp.write("data")
result = runner.invoke(
cli.cli, ["package", "extra database.db", "--secret", "sekrit"]
)
assert 0 == result.exit_code
assert (
"RUN datasette inspect 'extra database.db' --inspect-file inspect-data.json"
in capture.captured
)
assert "-i 'extra database.db'" in capture.captured