Stop oc.build from appending trailing slashes to hrefs#1521
Merged
Conversation
Part of #1515: browser client no longer emits .../name/version/ URLs so Fastify strict routing works without ignoreTrailingSlash. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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
Partial fix for #1515 focused on the browser client only.
oc.buildno longer forces a trailing slash on the generated component href. Hrefs go from.../name/version/to.../name/version, while still tolerating abaseUrlthat already ends in/.This is safe because:
urlBuilder.component()already emits no-slash URLsoc.renderByHrefuses the href as-is and does not depend on a final/In scope
oc-client-browseroc.buildURL constructionoc-client-browser(minor)Out of scope (still tracked in #1515)
ignoreTrailingSlashoption + default flip tofalsecomponentPreviewURL builder (.../~preview/)Fixes nothing end-to-end by itself for Fastify operators — it removes one first-party trailing-slash emitter so later registry/adapter work can default to strict routing safely.
Test plan
cd packages/oc-client-browser && npm test(244/244 passed)/and when version is present/absentDoes not close #1515 — leave it open until the remaining work lands.
Generated with Devin