Broken links on dev after the change to remove index.html pages
athomas opened this issue · 2 comments
Links on https://api.dart.dev/dev/latest/dart-core/ are broken.
Example BigInt
(note the extra dart-core): https://api.dart.dev/dev/latest/dart-core/dart-core/BigInt-class.html.
The backend bucket serving the site is configured with a main page suffix which is likely the reason for the broken links:
https://cloud.google.com/storage/docs/hosting-static-website#specialty-pages
How is this meant to be working? Should the loadbalancer serve the index.html
when it gets a request for https://api.dart.dev/dev/latest/dart-core/
? Would that work for older pages as well?
Note: it's likely infeasible to add special rules for versions in the load balancer so we'd have to find some config/dartdoc output combination that makes all stable versions work or do a data migration of the old content.
This was surprising as I thought we had sorted this out 😅 . I bisected down to 4d46129 as the culprit commit. Will work on a fix.
Looks like using package:web
, isAbsolute
is always true:
final hrefString = (node as HTMLAnchorElement).href;
final href = Uri.tryParse(hrefString);
href != null && href.isAbsolute;
hrefString
is something like "http://localhost:8000/dart-core/dart-core/BigInt-class.html", even if the HTML source is <a href="dart-core/BigInt-class.html">BigInt</a>
. Looking for an alternate API...