fix(office): probe star-office preferred_url host as given#456
Merged
Conversation
… rewriting to localhost
build_candidate_urls extracted only the port from preferred_url and
constructed every candidate as http://localhost:{port}. On remote
deployments (aionui --remote, browser on another machine) detection
then "succeeded" against the server-local service and the returned
localhost URL overwrote the user's configured address (aionui#3212).
- Keep the caller-supplied {scheme}://{host}:{port} as candidate 0,
in both scan and exact modes; localhost expansion is unchanged.
- Pick scan winners by candidate order rather than completion order so
the preferred URL beats an equivalent localhost candidate that
responds a few milliseconds earlier.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
StarOfficeDetector::build_candidate_urlsextracted only the port frompreferred_urland constructed every candidate ashttp://localhost:{port}. On remote deployments (aionui --remote, browser on another machine) detection silently "succeeded" against the server-local interface and the returnedhttp://localhost:19000overwrote the user's configured address — the Star Office half of [Bug]: 公网无头服务器部署:可视化办公室 URL 和文件预览硬编码 localhost,远程访问下功能不可用 AionUi#3212.{scheme}://{host}:{port}as candidate 0 (path/trailing slash stripped), in both scan and exact modes. The localhost known-port/±radius expansion is unchanged.Reproduction (before)
With a Star Office mock bound to
0.0.0.0:19000:After:
Test plan
detectreturns a healthy preferred URL verbatim even when the equivalent localhost candidate is also reachablecargo test -p aionui-office— all green (134 unit + integration suites)cargo fmt --check,cargo clippy -p aionui-office -D warningsaioncorebehind AionUi webui--remote): detect now returns the user-supplied address