Skip to content

Commit c6afb4c

Browse files
committed
nha: relax type matching in hari activity
The pattern was that the type uses uppercase, e.g. `DPJ/journal`. This commit updates the AVLXML doc finder in the hari activity so it also looks up `dpj/journal`. Not really expected for DPJ SIPs, but we've seen that's the case in `OTHER`.
1 parent 6c113f2 commit c6afb4c

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

internal/nha/activities/hari.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,23 +103,31 @@ func (a UpdateHARIActivity) avlxml(path string, kind nha.TransferType) string {
103103
return ""
104104
}
105105

106+
var (
107+
nhaType = kind.String()
108+
nhaTypeLower = strings.ToLower(nhaType)
109+
)
110+
106111
if kind == nha.TransferTypeAVLXML {
107112
const objekter = "objekter"
108-
matches, err := filepath.Glob(filepath.Join(path, kind.String(), objekter, "avlxml-*.xml"))
113+
matches, err := filepath.Glob(filepath.Join(path, nhaType, objekter, "avlxml-*.xml"))
109114
if err != nil {
110115
panic(err)
111116
}
112117
if len(matches) > 0 {
113118
return matches[0]
114119
}
115120
return firstMatch([]string{
116-
filepath.Join(path, kind.String(), objekter, "avlxml.xml"),
121+
filepath.Join(path, nhaType, objekter, "avlxml.xml"),
122+
filepath.Join(path, nhaTypeLower, objekter, "avlxml.xml"),
117123
})
118124
}
119125

120126
return firstMatch([]string{
121-
filepath.Join(path, kind.String(), "journal/avlxml.xml"),
122-
filepath.Join(path, kind.String(), "Journal/avlxml.xml"),
127+
filepath.Join(path, nhaType, "journal/avlxml.xml"),
128+
filepath.Join(path, nhaType, "Journal/avlxml.xml"),
129+
filepath.Join(path, nhaTypeLower, "journal/avlxml.xml"),
130+
filepath.Join(path, nhaTypeLower, "Journal/avlxml.xml"),
123131
})
124132
}
125133

0 commit comments

Comments
 (0)