Skip to content

Commit 5781721

Browse files
committed
Fix #802
1 parent 35a4eff commit 5781721

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Plugins/SCModelDownloader/SCModelDatabase.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,12 +289,21 @@ class CSCModelQueryBase : public ISCModelQueryInternal
289289
{
290290
auto nContentLength = UTIL_GetContentLength(ResponseInstance);
291291

292-
if (nContentLength >= 0 && size != nContentLength)
292+
// Only fail if actual size is LESS than Content-Length (incomplete download)
293+
// If actual size is greater, the Content-Length header might be outdated (common with CDN/cache)
294+
// and the data will be validated by subsequent JSON parsing or integrity checks
295+
if (nContentLength >= 0 && size < nContentLength)
293296
{
294-
gEngfuncs.Con_Printf("[SCModelDownloader] Content-Length mismatch for \"%s\": expect %d , got %d !\n", m_Url.c_str(), nContentLength, size);
297+
gEngfuncs.Con_Printf("[SCModelDownloader] Content-Length mismatch for \"%s\": expect %d , got %d ! Download might be incomplete.\n", m_Url.c_str(), nContentLength, size);
295298
return false;
296299
}
297300

301+
// Warn if actual size is greater than Content-Length (likely outdated metadata)
302+
if (nContentLength >= 0 && size > nContentLength)
303+
{
304+
gEngfuncs.Con_Printf("[SCModelDownloader] Warning: received more data than Content-Length for \"%s\": expect %d , got %d. Proceeding with validation...\n", m_Url.c_str(), nContentLength, size);
305+
}
306+
298307
//do nothing
299308
return true;
300309
}

0 commit comments

Comments
 (0)