Skip to content

Commit

Permalink
Merge pull request #1402 from cubiest/fix_filename_gen
Browse files Browse the repository at this point in the history
Fix output filenames that contain a forward slash or backslash
  • Loading branch information
stephenafamo authored Oct 23, 2024
2 parents 4e8f887 + fa0706a commit 9eaa10e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions boilingcore/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ func getLongExt(filename string) string {
}

func getOutputFilename(tableName string, isTest, isGo bool) string {
tableName = strings.ReplaceAll(strings.ReplaceAll(tableName, `/`, `_`), `\`, `_`)

if strings.HasPrefix(tableName, "_") {
tableName = "und" + tableName
}
Expand Down
6 changes: 6 additions & 0 deletions boilingcore/output_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ func TestGetOutputFilename(t *testing.T) {
IsGo: true,
Expected: "hello",
},
"contains_forward_slash": {
TableName: "slash/test",
IsTest: false,
IsGo: true,
Expected: "slash_test_model",
},
"begins with underscore": {
TableName: "_hello",
IsTest: false,
Expand Down

0 comments on commit 9eaa10e

Please sign in to comment.