Skip to content

Commit

Permalink
fix: \n character is handled different in windows
Browse files Browse the repository at this point in the history
  • Loading branch information
nandilabcup committed Oct 29, 2023
1 parent 9a5ceb8 commit bb53e2e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/cli/src/metadataGeneration/typeResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1103,13 +1103,13 @@ export class TypeResolver {
.replace(/{|}/g, '_') // SuccessResponse_{indexesCreated-number}_ -> SuccessResponse__indexesCreated-number__
.replace(/([a-z_0-9]+\??):([a-z]+)/gi, '$1-$2') // SuccessResponse_indexesCreated:number_ -> SuccessResponse_indexesCreated-number_
.replace(/;/g, '--')
.replace(/\r\n/g, '\n')
.replace(/([a-z})\]])\[([a-z]+)\]/gi, '$1-at-$2'); // Partial_SerializedDatasourceWithVersion[format]_ -> Partial_SerializedDatasourceWithVersion~format~_,

//Safety fixes to replace all characters which are not accepted by swagger ui
const formattedName = preformattedName.replace(/[^A-Za-z0-9\-._]/g, match => {
let formattedName = preformattedName.replace(/[^A-Za-z0-9\-._]/g, match => {
return `_${match.charCodeAt(0)}_`;
});
formattedName = formattedName.replace(/92_r_92_n/g, '92_n'); //Windows uses \r\n, but linux uses \n.

return formattedName;
}
Expand Down

0 comments on commit bb53e2e

Please sign in to comment.