Skip to content

Astro.url.pathname returns trailing slash on index page when base is set and trailingSlash is 'never' #13585

@derBlume

Description

@derBlume

Astro Info

Astro                    v5.6.1
Node                     v20.16.0
System                   macOS (x64)
Package Manager          unknown
Output                   server
Adapter                  @astrojs/node
Integrations             @sentry/astro

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

When configured with a base path 'base' and trailingSlash set to 'never', Astro.url.pathname returns /base/ for the root path, while import.meta.env.BASE_URL correctly respects the trailingSlash setting and returns /base, just as document.location.pathname does.

What's the expected result?

In the above example Astro.url.pathname should return '/base'

Link to Minimal Reproducible Example

https://stackblitz.com/edit/withastro-astro-a5kvvtuy?file=astro.config.mjs

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P4: importantViolate documented behavior or significantly impacts performance (priority)feat: routingRelated to Astro routing (scope)help wantedPlease help with this issue!pkg: astroRelated to the core `astro` package (scope)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions