Error when upload_dir contains multiple HTML files and no index.html#28
Error when upload_dir contains multiple HTML files and no index.html#28
Conversation
`locate_html_entrypoint` silently picked whichever HTML `WalkDir` yielded first, which produced confusing builds when users had stale exports alongside a current one (e.g. `pong.html` + `gamedevjsJam.html` after renaming). `index.html` still wins outright when present, so this doesn't break setups that intentionally ship helper HTML alongside the canonical entrypoint. When no `index.html` exists and multiple HTMLs are found, bail with a list of the ambiguous files and a message pointing at the two fixes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Claude finished @cloud9c's task in 1m 20s —— View job Code Review
Overall this is a clean, well-reasoned fix for a real user-facing footgun. The logic is easy to follow and the error message is actionable. A few observations below.
|
Address review on #28: `WalkDir` doesn't guarantee traversal order, so the list of files in the error message could vary per run on some filesystems. Also use `remove(0)` instead of `into_iter().next().unwrap()` — identical behavior, marginally clearer. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Thanks for the review. Applied:
Deferring to a follow-up:
|
|
Claude finished @cloud9c's task in 1m 3s —— View job Code Review
Both fixes from the first review round are correctly applied. The PR is clean.
|
|
example output: Error: Multiple HTML files found in upload_dir (././build-rename-test): Name one of them |
Based on /simplify review of #28: - `max_depth(1)` — only consider HTMLs directly under upload_dir. Avoids false "ambiguous" errors on engine-emitted nested HTML (e.g. Unity's `TemplateData/` or similar helper shells) and drops the worst-case walk cost from "entire asset tree" to "top-level entries". - Short-circuit once we've collected up to 8 HTMLs — the error message doesn't benefit from more, and this caps work for pathological cases while still showing every offender in the common small-N case. - Flatten the triple-nested if/let into a single `is_html` predicate. - Accept `.htm` alongside `.html` for consistency with `file_staging.rs`, which already accepts both for the user's configured entrypoint. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Claude finished @cloud9c's task in 1m 3s —— View job Code Review
The third commit ( New in
|
Summary
locate_html_entrypointsilently picked the first HTML returned byWalkDirwhenindex.htmlwas absent. A user re-exporting a Godot build with a different filename ended up withpong.html+gamedevjsJam.htmlinbuild/and didn't realize the old one was still being used.index.htmlstill wins outright (so you can ship helper HTML alongside the canonical entrypoint); if absent, exactly one other.htmlis required — otherwise the CLI errors and lists the ambiguous files.Error output
```
Error: Multiple HTML files found in upload_dir (./.):
Name one of them `index.html`, or remove the extras (often stale files from a previous export with a different name).
```
Test plan
🤖 Generated with Claude Code