Skip to content

Does not work with data URLs #2775

@mwisnicki

Description

@mwisnicki

Describe the bug
I thought I could quickly share work in progress schema by embedding it into base64 encoded data uri but unfortunately that didn't work.

openapi: 3.1.0
info:
  title: My Minimal API
  version: 1.0.0
paths: {}
open "$(printf "https://redocly.github.io/redoc/?nocors&url=data:;base64," && pbpaste | base64)"

Expected behavior
Redocly shows the spec from clipboard

Minimal reproducible OpenAPI snippet(if possible)

https://redocly.github.io/redoc/?nocors&url=data:;base64,b3BlbmFwaTogMy4xLjAKaW5mbzoKICB0aXRsZTogTXkgTWluaW1hbCBBUEkKICB2ZXJzaW9uOiAxLjAuMApwYXRoczoge30K

Generated from:

printf "https://redocly.github.io/redoc/?nocors&url=data:;base64," && cat << EOT | base64
openapi: 3.1.0
info:
  title: My Minimal API
  version: 1.0.0
paths: {}
EOT

Screenshots

Something went wrong...
i.lstatSync is not a function
Stack trace
Error: i.lstatSync is not a function
    at Object.<anonymous> (https://redocly.github.io/redoc/redoc-demo.bundle.js:2:33012)
    at Generator.next (<anonymous>)
    at https://redocly.github.io/redoc/redoc-demo.bundle.js:2:30967
    at new Promise (<anonymous>)
    at https://redocly.github.io/redoc/redoc-demo.bundle.js:2:30712
    at Object.loadExternalRef (https://redocly.github.io/redoc/redoc-demo.bundle.js:2:32614)
    at Object.<anonymous> (https://redocly.github.io/redoc/redoc-demo.bundle.js:2:33529)
    at Generator.next (<anonymous>)
    at https://redocly.github.io/redoc/redoc-demo.bundle.js:2:30967
    at new Promise (<anonymous>)

ReDoc Version: 2.5.0
Commit: 00bc6edf

Additional context
I disabled cors but redocly could be smart enough to do that for data urls.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions