Skip to content

Commit a48f9aa

Browse files
authored
Merge pull request #87 from Chr1Z93/file-names
Allow more characters in file names
2 parents 80ac77a + f9d9d6c commit a48f9aa

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

objects/objects.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,8 @@ func (o *objConfig) printToFile(filepath string, p *Printer) error {
322322
}
323323

324324
func (o *objConfig) getAGoodFileName() string {
325-
// only let alphanumberic, _, -, be put into names
326-
reg := regexp.MustCompile("[^a-zA-Z0-9_-]+")
325+
// This allows any letter or number from any language, plus _, -, and !
326+
reg := regexp.MustCompile(`[^\p{L}\p{N}_!-]+`)
327327

328328
keyname, err := o.tryGetNonEmptyStr("Nickname")
329329
if err != nil {

objects/objects_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,14 @@ func TestName(t *testing.T) {
404404
"Name": "Card",
405405
},
406406
guid: "010509",
407-
want: "OccultInvocation.010509",
407+
want: "OccultInvocation!!!!.010509",
408+
}, {
409+
data: types.J{
410+
"Nickname": "Verschwörung der Äxte!",
411+
"Name": "Card",
412+
},
413+
guid: "010511",
414+
want: "VerschwörungderÄxte!.010511",
408415
}, {
409416
data: types.J{
410417
"Name": "Card",

0 commit comments

Comments
 (0)