Skip to content

Commit 31ae302

Browse files
committed
implement escapeQuotationMark in bash generator
1 parent dd86f22 commit 31ae302

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/BashClientCodegen.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,8 @@ else if(collectionFormat.equals("pipes")) {
473473

474474
}
475475

476+
477+
476478
/**
477479
* Override with any special text escaping logic
478480
*/
@@ -562,7 +564,8 @@ public String escapeText(String input) {
562564

563565
@Override
564566
public String escapeQuotationMark(String input) {
565-
return input;
567+
// remove ' to avoid code injection
568+
return input.replace("'", "\'\\\'\'");
566569
}
567570

568571
/**

0 commit comments

Comments
 (0)