Skip to content

Commit 941c2ca

Browse files
committed
mdl "vararg" content length theoretical fix
I didn't reliably get the red texts or popups blocking the mdl load so I'm not 100% sure about replicability especially since it's been reported that it doesn't happen on all servers but I've had multiple reports and the theory is simple enough, so since I'm pretty sure this is where it happens I'm pretty sure this will fix the bug.
1 parent 30d9909 commit 941c2ca

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lua/pac3/core/shared/http.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,16 @@ function pac.getContentLength(url, cb, failcb)
106106
if string.lower(key) == "content-length" then
107107
length = tonumber(value)
108108

109+
--we started to get stuff like "7182199,0" from Google Drive, triggering the failstate because tonumber doesn't like varargs
110+
if not length then
111+
if string.find(value, ",") then
112+
local args = string.Split(value, ",")
113+
if args[1] then
114+
length = tonumber(args[1])
115+
end
116+
end
117+
end
118+
109119
if not length or math.floor(length) ~= length then
110120
return failcb(string.format("malformed server reply with header content-length (got %q, expected valid integer number)", value), true)
111121
end

0 commit comments

Comments
 (0)