Authored-By: OpenAI (GPT-5) <noreply@openai.com>
This commit is contained in:
+8
-2
@@ -204,12 +204,18 @@ def s3_sync(artifact, route, site_dir, credential_env_names=None):
|
||||
# so a fresh upload always carries the right MIME type.
|
||||
specific_paths = [rule["path"] for rule in artifact["cache_rules"] if rule["path"]]
|
||||
default_filters = [arg for path in specific_paths for arg in ("--exclude", f"{path}/*")]
|
||||
# A move from a nested route to `/` makes the old partition fall inside the
|
||||
# new sync scope. Preserve declared immutable subtrees at every retired
|
||||
# prefix without enumerating the bucket.
|
||||
retired_immutable_filters = [
|
||||
arg for path in immutable_paths for arg in ("--exclude", f"*/{path}/*")
|
||||
]
|
||||
run(["aws", "--endpoint-url", endpoint, "s3", "cp", f"{html_dir}/", destination,
|
||||
"--recursive", "--only-show-errors", "--cache-control", default_cache,
|
||||
*default_filters, *exclude_args], env=aws_env)
|
||||
*default_filters, *retired_immutable_filters, *exclude_args], env=aws_env)
|
||||
run(["aws", "--endpoint-url", endpoint, "s3", "sync", f"{html_dir}/", destination,
|
||||
"--delete", "--only-show-errors", "--cache-control", default_cache,
|
||||
*default_filters, *exclude_args], env=aws_env)
|
||||
*default_filters, *retired_immutable_filters, *exclude_args], env=aws_env)
|
||||
for rule in artifact["cache_rules"]:
|
||||
if not rule["path"]:
|
||||
continue
|
||||
|
||||
+9
-1
@@ -432,7 +432,15 @@ def validate_artifact_inputs(site_dir, cfg):
|
||||
root = Path(site_dir).resolve()
|
||||
sources = []
|
||||
for artifact in cfg["artifacts"]:
|
||||
source = (root / artifact["content_dir"]).resolve()
|
||||
declared = root
|
||||
for component in Path(artifact["content_dir"]).parts:
|
||||
declared /= component
|
||||
if declared.is_symlink():
|
||||
raise ConfigError(
|
||||
f"artifact {artifact['name']} content_dir contains symlink component: "
|
||||
f"{declared.relative_to(root)}"
|
||||
)
|
||||
source = declared.resolve()
|
||||
if source != root and root not in source.parents:
|
||||
raise ConfigError(
|
||||
f"artifact {artifact['name']} content_dir resolves outside the repository"
|
||||
|
||||
Reference in New Issue
Block a user