Skip to content

Commit f6d22e4

Browse files
committed
#8482 Fix for NodeJS DefaultController Windows Path Bug
1 parent 74197cc commit f6d22e4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,13 @@ public String apiFilename(String templateName, String tag) {
158158
String result = super.apiFilename(templateName, tag);
159159

160160
if (templateName.equals("service.mustache")) {
161-
String stringToMatch = File.separator + "controllers" + File.separator;
162-
String replacement = File.separator + implFolder + File.separator;
163-
result = result.replaceAll(Pattern.quote(stringToMatch), replacement);
161+
String regexFileSep = File.separator;
162+
if (regexFileSep.equals("\\")) {
163+
regexFileSep = "\\\\";
164+
}
165+
String stringToMatch = regexFileSep + "controllers" + regexFileSep;
166+
String replacement = regexFileSep + implFolder + regexFileSep;
167+
result = result.replaceAll(stringToMatch, replacement);
164168
}
165169
return result;
166170
}

0 commit comments

Comments
 (0)