Skip to content

Commit

Permalink
Capture identifiers not based on RFC 4122
Browse files Browse the repository at this point in the history
  • Loading branch information
sevein committed Apr 18, 2023
1 parent daaf06a commit 1ea9a87
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/nha/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var regexTransfer = regexp.MustCompile(
`(?P<type>(?i:DPJ|EPJ|OTHER|AVL-DPJ|AVL-EPJ|AVL-OTHER))-(?i:SIP)` +
`[-_]` +
`(?:` +
`(?P<journalidentifikator>[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[1-5][a-zA-Z0-9]{3}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12})` +
`(?P<journalidentifikator>[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12})` +
`|` +
`(?P<avleveringsidentifikator>[0-9.]+)[-_](?P<date>\d{6,8})` +
`)` +
Expand Down
11 changes: 11 additions & 0 deletions internal/nha/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,17 @@ func TestParse(t *testing.T) {
Value: "dpj-sip-814ecc88-b459-4304-8868-9ed72875f5fc",
},
},
{
desc: "Identifiers not based on RFC 4122",
input: "dpj-sip-4ba94e92-d200-81eb-b8bc-0242ac130003",
wantResult: NameInfo{
Identifier: "4ba94e92-d200-81eb-b8bc-0242ac130003",
Type: TransferTypeDPJ,
Date: time.Time{},
Extension: "",
Value: "dpj-sip-4ba94e92-d200-81eb-b8bc-0242ac130003",
},
},
{
desc: "Unexpected UUID format",
input: "dpj-sip-814ecc88-b459-4304-8868-9ed72875f5fZ",
Expand Down

0 comments on commit 1ea9a87

Please sign in to comment.