Skip to content

Commit

Permalink
fix wrong file write path
Browse files Browse the repository at this point in the history
  • Loading branch information
Lythium4848 authored Aug 18, 2023
1 parent be71ee1 commit f81d385
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lua/pixelui/core/cl_images.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@ local function processQueue()
materials[filePath] = Material("nil")
else
local contentType = headers["Content-Type"]
local writeFilePath = filePath
if not endsWithExtension(filePath) then
filePath = filePath .. (contentTypes[contentType] or ".png")
writeFilePath = filePath .. (contentTypes[contentType] or ".png")
end

file.Write(filePath, body)
materials[filePath] = Material("../data/" .. filePath, matSettings or "noclamp smooth mips")
file.Write(writeFilePath, body)
materials[filePath] = Material("../data/" .. writeFilePath, matSettings or "noclamp smooth mips")
end

callback(materials[filePath])
Expand Down Expand Up @@ -110,4 +111,4 @@ end
function PIXEL.GetImgur(id, callback, _, matSettings)
local url = "https://i.imgur.com/" .. id .. ".png"
PIXEL.GetImage(url, callback, matSettings)
end
end

0 comments on commit f81d385

Please sign in to comment.