Skip to content

Conversation

@jpnurmi
Copy link
Member

@jpnurmi jpnurmi commented Oct 26, 2020

Description

When creating a new Flutter Web app, the generated index.html contains
the following information:

<!--
  If you are serving your web app in a path other than the root, change the
  href value below to reflect the base path you are serving from.

  The path provided below has to start and end with a slash "/" in order for
  it to work correctly.

  Fore more details:
  * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
-->
<base href="/">

The MDN web docs mentioned "document.baseURI", so this patch is using
window.document.baseUri to get the base URL for version.json.

Related Issues

#26

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]).
This will ensure a smooth and quick review process. Updating the pubspec.yaml and changelogs is not required.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (flutter analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate a breaking change in CHANGELOG.md and increment major revision).
  • No, this is not a breaking change.

When creating a new Flutter Web app, the generated index.html contains
the following information:

    <!--
      If you are serving your web app in a path other than the root, change the
      href value below to reflect the base path you are serving from.

      The path provided below has to start and end with a slash "/" in order for
      it to work correctly.

      Fore more details:
      * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
    -->
    <base href="/">

The MDN web docs mentioned "document.baseURI", so this patch is using
`window.document.baseUri` to get the base URL for version.json.

Fix: #26
@deakjahn
Copy link

Clever. :-)

Copy link
Member

@mhadaily mhadaily left a comment

Choose a reason for hiding this comment

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

LGTM

@mhadaily mhadaily merged commit 5447a9d into main Oct 26, 2020
@mhadaily mhadaily deleted the fix/pkg-info-root branch October 26, 2020 18:19
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants