Skip to content

Commit 48f6f09

Browse files
committed
fix springfiles probe: lowercase filename in URL
Springfiles is Apache on Linux (case-sensitive) and stores all 3570 of its map filenames lowercase — verified against the live catalog, zero exceptions. ZK keeps original casing on ResourceContentFile.FileName (e.g. Sever_1.sd7, Gasbag_Grabens_1.1.1.sd7), so the HEAD probe at .../files/maps/{cf.FileName} returns 404 for every CamelCase map, the probe writes LinkCount=0, and the result sticks for 24 h. Affects far more than the 5 maps in #3057 — any map whose original upload preserved capital letters has had a permanently-broken SF mirror. Lowercased the filename component in the three places that build the springfiles URL (BuildLinks, RunProbe's inner cache check, ProbeAndAssign). The local URL keeps original casing — IIS on the ZK host is case-insensitive, no change needed there. Existing cached state with the old mixed-case URL stays "missing" until the natural 24 h cache expiry, at which point each map gets re-probed with the lowercased URL and recovers.
1 parent 0605614 commit 48f6f09

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

Zero-K.info/AppCode/ResourceLinkProvider.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ public static List<string> BuildLinks(ResourceContentFile content)
7272

7373
var subfolder = content.Resource.TypeID == ResourceType.Map ? "maps" : "games";
7474
var localUrl = $"{GlobalConst.BaseSiteUrl}/content/{subfolder}/{content.FileName}";
75-
var springfilesUrl = $"{GlobalConst.SpringfilesBaseUrl}files/{subfolder}/{content.FileName}";
75+
// springfiles runs on case-sensitive Apache and stores all 3500+ map filenames lowercase;
76+
// probing with mixed-case yields 404 even when the map is there.
77+
var springfilesUrl = $"{GlobalConst.SpringfilesBaseUrl}files/{subfolder}/{content.FileName.ToLower()}";
7678

7779
var links = new List<string>();
7880
if (File.Exists(Global.MapPath($"~/content/{subfolder}/{content.FileName}"))) links.Add(localUrl);
@@ -132,7 +134,7 @@ static bool RunProbe(string md5)
132134
&& DateTime.UtcNow.Subtract(cf.Resource.LastLinkCheck.Value).TotalHours < SpringfilesRecheckHours)
133135
{
134136
var subfolder = cf.Resource.TypeID == ResourceType.Map ? "maps" : "games";
135-
var springfilesUrl = $"{GlobalConst.SpringfilesBaseUrl}files/{subfolder}/{cf.FileName}";
137+
var springfilesUrl = $"{GlobalConst.SpringfilesBaseUrl}files/{subfolder}/{cf.FileName.ToLower()}";
136138
return !string.IsNullOrEmpty(cf.Links) && cf.Links.Split('\n').Contains(springfilesUrl);
137139
}
138140

@@ -169,7 +171,8 @@ static bool ProbeAndAssign(ResourceContentFile cf)
169171
{
170172
var subfolder = cf.Resource.TypeID == ResourceType.Map ? "maps" : "games";
171173
var localUrl = $"{GlobalConst.BaseSiteUrl}/content/{subfolder}/{cf.FileName}";
172-
var springfilesUrl = $"{GlobalConst.SpringfilesBaseUrl}files/{subfolder}/{cf.FileName}";
174+
// SF stores all map filenames lowercase; see BuildLinks for the rationale.
175+
var springfilesUrl = $"{GlobalConst.SpringfilesBaseUrl}files/{subfolder}/{cf.FileName.ToLower()}";
173176

174177
var hasSpringfiles = HeadCheck(springfilesUrl, cf.Length);
175178

0 commit comments

Comments
 (0)