Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The generated library URLs need an ending slash #3936

Closed
isoos opened this issue Nov 26, 2024 · 3 comments · Fixed by #3940
Closed

The generated library URLs need an ending slash #3936

isoos opened this issue Nov 26, 2024 · 3 comments · Fixed by #3940
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@isoos
Copy link
Contributor

isoos commented Nov 26, 2024

The documentation URLs for libraries generated by 8.3.0 are missing an ending slash. When hosted, this breaks the sidebar and all relative links, as the base-uri reference is one directory up.

To fix that, the hosting needs to redirect from /library-x to /library-x/, and that is one extra request (extra latency) that could have been spared with the ending slash.

Related note: The change of the library URLs (#3895) is breaking pub.dev in multiple ways. We should explore how we could define a somewhat future-proof way to prevent or mitigate such disruptions. (We should also prevent situations where we need the beta SDK to analyze or generate sources for packages requiring the same beta SDK, but that's another discussion.)

@isoos
Copy link
Contributor Author

isoos commented Nov 26, 2024

/cc @srawlins

@srawlins
Copy link
Member

srawlins commented Dec 3, 2024

I tested the new URLs only with serving the HTML files on disk via the dhttpd package, which I think behaves like vanilla Apache, and loads /index.html if it is available. But I guess this is not universal behavior. We can instead link to library-x/.

Thanks for the report, @isoos

@srawlins srawlins added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) P1 A high priority bug; for example, a single project is unusable or has many test failures labels Dec 3, 2024
@isoos
Copy link
Contributor Author

isoos commented Dec 3, 2024

Thanks for looking into it!

Btw. python -m http.server does the extra redirect:

127.0.0.1 - - [03/Dec/2024 09:16:47] "GET /analyzer/6.11.0/dart_ast_ast HTTP/1.1" 301 -
127.0.0.1 - - [03/Dec/2024 09:16:47] "GET /analyzer/6.11.0/dart_ast_ast/ HTTP/1.1" 200 -

And if the browser requested the URL without the ending slash and the webserver served the index.html without redirecting, it breaks the relative links and the sidebar loading, as they are one-level off (verified while adopting this to pub-dev).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants