Commit d0e1672
committed
fix: serve sitemap.xml in-memory via controller endpoint
Replace startup file-write of sitemap.xml with a dynamic /sitemap.xml
controller action. This eliminates the UnauthorizedAccessException caused
by the non-root app user being unable to write to /app/wwwroot/sitemap.xml.
- Add SitemapXml() action to HomeController using SitemapProvider.CreateSitemap
- Inject IOptions<SiteSettings> for base URL, IRouteConfigurationService via [FromServices]
- Remove GenerateAndSerializeSitemapXml (file-write) from SitemapXmlHelpers
- Remove unused DirectoryInfo parameter from GenerateSitemapXml
- Remove startup sitemap file-write from Program.cs; keep EnsureSitemapHealthy for fail-fast validation
- Update tests to match new GenerateSitemapXml signature
- Inline BuildKit secret in CI workflow (no temp PAT file)
Serving from memory is also more secure: no write permissions needed,
no stale file on disk, and the content is always fresh.1 parent 21d199a commit d0e1672
4 files changed
Lines changed: 16 additions & 38 deletions
File tree
- EssentialCSharp.Web.Tests
- EssentialCSharp.Web
- Controllers
- Helpers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
4 | 3 | | |
| |||
70 | 69 | | |
71 | 70 | | |
72 | 71 | | |
73 | | - | |
74 | 72 | | |
75 | 73 | | |
76 | 74 | | |
77 | 75 | | |
78 | 76 | | |
79 | 77 | | |
80 | | - | |
81 | 78 | | |
82 | 79 | | |
83 | 80 | | |
| |||
98 | 95 | | |
99 | 96 | | |
100 | 97 | | |
101 | | - | |
102 | 98 | | |
103 | 99 | | |
104 | 100 | | |
105 | 101 | | |
106 | 102 | | |
107 | 103 | | |
108 | | - | |
109 | 104 | | |
110 | 105 | | |
111 | 106 | | |
| |||
126 | 121 | | |
127 | 122 | | |
128 | 123 | | |
129 | | - | |
130 | 124 | | |
131 | 125 | | |
132 | 126 | | |
| |||
139 | 133 | | |
140 | 134 | | |
141 | 135 | | |
142 | | - | |
143 | 136 | | |
144 | 137 | | |
145 | 138 | | |
| |||
156 | 149 | | |
157 | 150 | | |
158 | 151 | | |
159 | | - | |
160 | 152 | | |
161 | 153 | | |
162 | 154 | | |
163 | 155 | | |
164 | 156 | | |
165 | 157 | | |
166 | | - | |
167 | 158 | | |
168 | 159 | | |
169 | 160 | | |
| |||
179 | 170 | | |
180 | 171 | | |
181 | 172 | | |
182 | | - | |
183 | 173 | | |
184 | 174 | | |
185 | 175 | | |
186 | 176 | | |
187 | 177 | | |
188 | 178 | | |
189 | | - | |
190 | 179 | | |
191 | 180 | | |
192 | 181 | | |
| |||
202 | 191 | | |
203 | 192 | | |
204 | 193 | | |
205 | | - | |
206 | 194 | | |
207 | 195 | | |
208 | 196 | | |
| |||
214 | 202 | | |
215 | 203 | | |
216 | 204 | | |
217 | | - | |
218 | 205 | | |
219 | 206 | | |
220 | 207 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
| 3 | + | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| 10 | + | |
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
11 | | - | |
| 14 | + | |
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
| |||
86 | 89 | | |
87 | 90 | | |
88 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
89 | 100 | | |
90 | 101 | | |
91 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
7 | | - | |
| 6 | + | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
| |||
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
| 21 | + | |
32 | 22 | | |
33 | 23 | | |
34 | 24 | | |
| |||
98 | 88 | | |
99 | 89 | | |
100 | 90 | | |
101 | | - | |
102 | | - | |
103 | 91 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
569 | 569 | | |
570 | 570 | | |
571 | 571 | | |
572 | | - | |
573 | | - | |
| 572 | + | |
574 | 573 | | |
575 | 574 | | |
576 | 575 | | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | 576 | | |
581 | 577 | | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | 578 | | |
586 | | - | |
587 | 579 | | |
588 | 580 | | |
589 | 581 | | |
590 | 582 | | |
591 | 583 | | |
592 | | - | |
| 584 | + | |
593 | 585 | | |
594 | 586 | | |
595 | 587 | | |
| |||
0 commit comments