Explorar o código

fix: 使用二进制模式打开文件以兼容Windows系统

zhanghaijun hai 9 meses
pai
achega
4ec431b544
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      develop/course/lua/course_upload.lua

+ 2 - 2
develop/course/lua/course_upload.lua

@@ -56,8 +56,8 @@ while true do
                     return
                 end
 
-                -- 打开文件写入
-                file, err = io.open(fullpath, "w+")
+                -- 打开文件写入(Windows 下需用二进制模式)
+                file, err = io.open(fullpath, "wb")
                 if not file then
                     ngx.say(cjson.encode({ code = 500, msg = "无法创建文件: " .. (err or ""), data = {} }))
                     return