Skip to content

Issue with index html resources paths when using a complex path as route prefix #180

Closed
@jpb06

Description

@jpb06

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

5.0.0

Plugin version

5.1.0

Node.js version

20.18

Operating system

macOS

Operating system version (i.e. 20.04, 11.3, 10)

15.0.1

Description

It's appears #178 is causing an issue when using a complex path in routePrefix, ie:

await this.instance.register(fastifySwaggerUI, {
  routePrefix: '/api/vi/$docs'
});

The resolved path looks like /api/v1/api/v1/$docs/static in that case.

image

See linked repo for MRE.

Link to code that reproduces the bug

https://github.com/jpb06/fastify-swagger-ui-routeprefix-issue-repro

Expected Behavior

index resources to load properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions