Skip to content

Spec hyperlink broken with relative spec URL #4107

@larshp

Description

@larshp
Q A
Bug or feature request? Bug
Which Swagger/OpenAPI version? 2.0
Which Swagger-UI version? 3.9.0
How did you install Swagger-UI? loading via cdnjs
Which browser & version? Chrome 63.0.3239.132
Which operating system? Windows

Expected Behavior

Clicking the spec link will show the spec

image

Current Behavior

Instead it links to about:blank. Testing the operations and everything else works, the link worked in 3.0.18

image

The issue can also be reproduced on the petstore,
image

Possible Solution

The url is sanitized via

{ url && <a target="_blank" href={ sanitizeUrl(url) }><span className="url"> { url } </span></a> }

which calls
https://github.com/braintree/sanitize-url/blob/master/index.js
but the relative url does not contain ":" so the regex fails and the link becomes "about:blank"

Context

Workaround is to just copy/paste the spec url into the browser address

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions