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

fix: relative url error related to console errors #6228

Merged
merged 3 commits into from
Nov 10, 2023
Merged

Conversation

sowmya-kota07
Copy link
Contributor

@sowmya-kota07 sowmya-kota07 commented Nov 7, 2023

Description of changes:

Fix Console Errors: https://github.com/aws-amplify/docs/actions/runs/6580015445/job/17877101477?pr=5966

Staging site: https://internal-links.d1ywzrxfkb9wgg.amplifyapp.com/

Errors Reasons
urls like this will produce a double slash /lib/datastore/setup-auth-rules/ this also includes urls with a slash and hash /lib/datastore/setup-auth-rules/#something an example of this can be found on page http://localhost:3000/lib/datastore/sync/q/platform/android/ and the link for this is in src/fragments/lib/datastore/android/sync/50-selectiveSync.mdx

This will resolve the error

Invalid href '/lib-v1/datastore/setup-auth-rules//q/platform/android#configure-multiple-authorization-types' passed to next/router in page: '/lib-v1/graphqlapi/authz/q/platform/[platform]'. Repeated forward-slashes (//) or backslashes \ are not valid in the href. found on http://localhost:3000/lib-v1/graphqlapi/authz/q/platform/android/

Related GitHub issue #, if available:

Instructions

If this PR should not be merged upon approval for any reason, please submit as a DRAFT

Which product(s) are affected by this PR (if applicable)?

  • amplify-cli
  • amplify-ui
  • amplify-studio
  • amplify-hosting
  • amplify-libraries

Which platform(s) are affected by this PR (if applicable)?

  • JS
  • iOS
  • Android
  • Flutter
  • React Native

Please add the product(s)/platform(s) affected to the PR title

Checks

  • Does this PR conform to the styleguide?

  • Does this PR include filetypes other than markdown or images? Please add or update unit tests accordingly.

  • Are any files being deleted with this PR? If so, have the needed redirects been created?

  • Are all links in MDX files using the MDX link syntax rather than HTML link syntax?

    ref: MDX: [link](https://link.com)
    HTML: <a href="https://link.com">link</a>

When this PR is ready to merge, please check the box below

  • Ready to merge

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@sowmya-kota07 sowmya-kota07 requested a review from a team as a code owner November 7, 2023 19:46
Copy link
Contributor

@hbuchel hbuchel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you check other pages that are using this component to see if this change breaks those links? Looking at the failed link checker test on this PR I'm wondering if the path passed to InternalLink needs to be updated and not the component itself. Can you please verify that?

Copy link
Contributor

@reesscot reesscot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking for now since the staging build is failing

@sowmya-kota07 sowmya-kota07 marked this pull request as draft November 8, 2023 17:20
@sowmya-kota07 sowmya-kota07 force-pushed the Internal-links branch 5 times, most recently from cb36c30 to 0b5ca98 Compare November 10, 2023 00:02
@sowmya-kota07 sowmya-kota07 marked this pull request as ready for review November 10, 2023 00:03
if (hrefParts[0].endsWith('/')) {
href = `${hrefParts[0]}q/${filterKind}/${filterKey}#${hrefParts[1]}`;
} else {
href = `${hrefParts[0]}/q/${filterKind}/${filterKey}/${hrefParts[1]}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing # on this line ${hrefParts[0]}/q/${filterKind}/${filterKey}#${hrefParts[1]}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!!

@jacoblogan
Copy link
Contributor

Ran the console error script locally against this change and all of the // errors have been resolved

Copy link
Contributor

@hbuchel hbuchel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @sowmyadev-kota

@sowmya-kota07 sowmya-kota07 merged commit 5b5e82b into main Nov 10, 2023
@sowmya-kota07 sowmya-kota07 deleted the Internal-links branch November 10, 2023 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants