diff --git a/src/segments/umbraco.go b/src/segments/umbraco.go index 5c3209fd..2abcd0dc 100644 --- a/src/segments/umbraco.go +++ b/src/segments/umbraco.go @@ -142,7 +142,7 @@ func (u *Umbraco) TryFindLegacyUmbraco(configPath string) bool { // Loop over all the package references for _, appSetting := range webConfigAppSettings.AppSettings { - if strings.EqualFold(appSetting.Key, "umbraco.core.configurationstatus") { + if strings.EqualFold(appSetting.Key, "umbraco.core.configurationstatus") || strings.EqualFold(appSetting.Key, "umbracoConfigurationStatus") { u.Modern = false if len(appSetting.Value) == 0 { diff --git a/src/segments/umbraco_test.go b/src/segments/umbraco_test.go index c26deead..bdbc3356 100644 --- a/src/segments/umbraco_test.go +++ b/src/segments/umbraco_test.go @@ -16,13 +16,14 @@ import ( func TestUmbracoSegment(t *testing.T) { cases := []struct { - Case string - ExpectedEnabled bool - ExpectedString string - Template string - HasUmbracoFolder bool - HasCsproj bool - HasWebConfig bool + Case string + ExpectedEnabled bool + ExpectedString string + Template string + HasUmbracoFolder bool + HasCsproj bool + HasWebConfig bool + UseLegacyWebConfig bool }{ { Case: "No Umbraco folder found", @@ -45,6 +46,16 @@ func TestUmbracoSegment(t *testing.T) { Template: "{{ .Version }}", ExpectedString: "8.18.9", }, + { + Case: "Umbraco Folder and web.config but NO .csproj and uses older web.config", + HasUmbracoFolder: true, + HasCsproj: false, + HasWebConfig: true, + UseLegacyWebConfig: true, + ExpectedEnabled: true, // Segment should be enabled and visible + Template: "{{ .Version }}", + ExpectedString: "4.11.10", + }, { Case: "Umbraco Folder and .csproj but NO web.config", HasUmbracoFolder: true, @@ -74,7 +85,14 @@ func TestUmbracoSegment(t *testing.T) { sampleCSProj = string(content) } if tc.HasWebConfig { - content, _ := os.ReadFile("../test/umbraco/web.config") + var filePath string + if tc.UseLegacyWebConfig { + filePath = "../test/umbraco/web.old.config" + } else { + filePath = "../test/umbraco/web.config" + } + + content, _ := os.ReadFile(filePath) sampleWebConfig = string(content) } diff --git a/src/test/umbraco/web.old.config b/src/test/umbraco/web.old.config new file mode 100644 index 00000000..3f4d6f63 --- /dev/null +++ b/src/test/umbraco/web.old.config @@ -0,0 +1,233 @@ + + + +
+
+
+
+
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file