Skip to content

Commit

Permalink
fix: crash when $ref is url encoded
Browse files Browse the repository at this point in the history
reported by @mikunn
  • Loading branch information
RomanHotsiy committed Nov 23, 2017
1 parent 343f51a commit bdf6079
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"json-schema-ref-parser": "^3.3.1",
"mobx": "^3.3.0",
"mobx-react": "^4.3.3",
"openapi-sampler": "^1.0.0-beta.1",
"openapi-sampler": "1.0.0-beta.8",
"prismjs": "^1.8.1",
"prop-types": "^15.6.0",
"react-dropdown": "^1.3.0",
Expand Down
1 change: 1 addition & 0 deletions src/services/OpenAPIParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export class OpenAPIParser {
let res;
if (this.spec === undefined) return;
if (ref.charAt(0) !== '#') ref = '#' + ref;
ref = decodeURI(ref);
try {
res = JsonPointer.get(this.spec, decodeURIComponent(ref));
} catch (e) {
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4670,9 +4670,9 @@ ono@^4.0.2:
dependencies:
format-util "^1.0.3"

openapi-sampler@^1.0.0-beta.1:
version "1.0.0-beta.7"
resolved "https://registry.yarnpkg.com/openapi-sampler/-/openapi-sampler-1.0.0-beta.7.tgz#4932a3994067af86f95cb912ee56d01123e27d88"
[email protected].8:
version "1.0.0-beta.8"
resolved "https://registry.yarnpkg.com/openapi-sampler/-/openapi-sampler-1.0.0-beta.8.tgz#bf43ff47737fc4e1f988d0e2082d49788f41dead"
dependencies:
json-pointer "^0.6.0"

Expand Down

0 comments on commit bdf6079

Please sign in to comment.