Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- When cloning a repo with Configure, that repo's embedded-git-config file will overwrite previous settings (#819)
- Settings page no longer removes remote when saving after cloning (#858)
- Fixed import of HL7 and LUT files added at the same time as their mappings (#864)

## [2.13.1] - 2025-09-16

Expand Down
39 changes: 39 additions & 0 deletions cls/SourceControl/Git/File.cls
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ ClassMethod ExternalNameToInternalName(ExternalName As %String) As %String
}
new %SourceControl //don't trigger source hooks with this test load to get the Name
set sc=$system.OBJ.Load(ExternalName,"-d",,.outName,1)
// If the test load was unsuccessful then it may be due to an unsupported
// file type (e.g. hl7 or lut) that we may otherwise be able to handle
if $$$ISERR(sc) {
set outName = ..ParseFileForInternalName(ExternalName)
}
set itemIsPTD = 0
if $data(outName) = 11 {
set key = $order(outName(""))
Expand All @@ -59,6 +64,40 @@ ClassMethod ExternalNameToInternalName(ExternalName As %String) As %String
quit internalName
}

/// Attempt to determine the internal name of a given file based on its content
/// Intended to be used in situations where $system.OBJ.Load is unable to
ClassMethod ParseFileForInternalName(fileName As %String) As %String [ Private ]
{
Set internalName = ""

Set fileExtension = $ZCONVERT($PIECE(fileName,".",*),"U")
If (fileExtension = "HL7") {
Set tSC = ##class(%XML.TextReader).ParseFile(fileName, .textReader)
If ($$$ISOK(tSC)) {
// The HL7 schema name is in the 'name' attribute of the 'Category' element
// Example: <Category name="...">
If (textReader.ReadStartElement("Category") && textReader.MoveToAttributeName("name")) {
If (textReader.Value '= "") {
Set internalName = textReader.Value_"."_fileExtension
}
}
}
} ElseIf (fileExtension = "LUT") {
Set tSC = ##class(%XML.TextReader).ParseFile(fileName, .textReader)
If $$$ISOK(tSC) {
// The lookup table name is in the 'table' attribute of any 'entry' element
// Example: <entry table="...">
If (textReader.ReadStartElement("entry") && textReader.MoveToAttributeName("table")) {
If (textReader.Value '= "") {
Set internalName = textReader.Value_"."_fileExtension
}
}
}
}

Quit internalName
}

Storage Default
{
<Data name="FileDefaultData">
Expand Down
Loading