Skip to content

Commit

Permalink
fix(@nestjs/swagger): replace quoted functionPlaceholder completely
Browse files Browse the repository at this point in the history
When building JS InitOptions, functions get replaced by a placeholder.
JSON.stringify quotes strings, so we need to replace the placeholder
including the quotes.

Fixes:  #1962
  • Loading branch information
Panzer1119 committed Jul 8, 2022
1 parent 207de33 commit 2afc3dc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/swagger-ui/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function buildJSInitOptions(initOptions: SwaggerUIInitOptions) {
2
);

json = json.replace(new RegExp(functionPlaceholder, 'g'), () => fns.shift());
json = json.replace(new RegExp('"' + functionPlaceholder + '"', 'g'), () => fns.shift());

return `let options = ${json};`;
}

0 comments on commit 2afc3dc

Please sign in to comment.