mirror of
https://github.com/pesde-pkg/tooling.git
synced 2025-04-07 12:20:55 +01:00
fix: correctly parse base64 with whitespace
This commit is contained in:
parent
3e22a38dca
commit
ad36473326
10 changed files with 9 additions and 18 deletions
|
@ -167,7 +167,7 @@ for _, binSrc in pathfs.readDir(BINS_SRC_DIR) do
|
||||||
type = "Custom",
|
type = "Custom",
|
||||||
payload = {
|
payload = {
|
||||||
method = "GET",
|
method = "GET",
|
||||||
url = `https://api.github.com/repos/{repoName}/contents/README.md`,
|
url = `https://api.github.com/repos/{repoName}/readme`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -181,20 +181,10 @@ for _, binSrc in pathfs.readDir(BINS_SRC_DIR) do
|
||||||
-- NOTE: Github uses a special format for encoding the contents, where it
|
-- NOTE: Github uses a special format for encoding the contents, where it
|
||||||
-- separates the entire file into multiple lines, and encodes each line in
|
-- separates the entire file into multiple lines, and encodes each line in
|
||||||
-- base64
|
-- base64
|
||||||
local lines = string.split(resp.content, "\n")
|
|
||||||
local decoded = buffer.create(resp.size)
|
|
||||||
local cum = 0
|
|
||||||
for _, line in lines do
|
|
||||||
if line == "" then
|
|
||||||
-- Skip empty lines
|
|
||||||
continue
|
|
||||||
end
|
|
||||||
|
|
||||||
local src = base64.decode(buffer.fromstring(line))
|
|
||||||
buffer.copy(decoded, math.clamp(cum - 1, 0, math.huge), src)
|
|
||||||
cum += buffer.len(src)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
-- This should be done by the base64 library, but oh well
|
||||||
|
local content = string.gsub(resp.content, "%s+", "")
|
||||||
|
local decoded = base64.decode(buffer.fromstring(content))
|
||||||
return Result.Ok(decoded)
|
return Result.Ok(decoded)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -210,6 +200,8 @@ for _, binSrc in pathfs.readDir(BINS_SRC_DIR) do
|
||||||
|
|
||||||
-- Write the updated README to the tool's directory
|
-- Write the updated README to the tool's directory
|
||||||
local readmeContents = readmeRes:unwrap()
|
local readmeContents = readmeRes:unwrap()
|
||||||
|
-- There used to be some issues with encoding if not deleted and recreated
|
||||||
|
pathfs.removeFile(readmePath)
|
||||||
pathfs.writeFile(readmePath, readmeContents)
|
pathfs.writeFile(readmePath, readmeContents)
|
||||||
|
|
||||||
print(
|
print(
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,7 +1,7 @@
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<h1>
|
<h1>
|
||||||
StyLua<br>
|
StyLua<br>
|
||||||
<ahref="https://crates.io/crates/stylua"><img src="https://img.shields.io/crates/v/stylua.svg"></a>
|
<a href="https://crates.io/crates/stylua"><img src="https://img.shields.io/crates/v/stylua.svg"></a>
|
||||||
<a href="https://github.com/JohnnyMorganz/StyLua/actions/workflows/ci.yml"><img src="https://github.com/JohnnyMorganz/StyLua/actions/workflows/ci.yml/badge.svg"></a>
|
<a href="https://github.com/JohnnyMorganz/StyLua/actions/workflows/ci.yml"><img src="https://github.com/JohnnyMorganz/StyLua/actions/workflows/ci.yml/badge.svg"></a>
|
||||||
<a href="https://codecov.io/gh/JohnnyMorganz/StyLua"><img src="https://codecov.io/gh/JohnnyMorganz/StyLua/branch/main/graph/badge.svg"/></a>
|
<a href="https://codecov.io/gh/JohnnyMorganz/StyLua"><img src="https://codecov.io/gh/JohnnyMorganz/StyLua/branch/main/graph/badge.svg"/></a>
|
||||||
</h1>
|
</h1>
|
||||||
|
@ -301,4 +301,3 @@ space_after_function_names = "Never"
|
||||||
[sort_requires]
|
[sort_requires]
|
||||||
enabled = false
|
enabled = false
|
||||||
```
|
```
|
||||||
|
|
Binary file not shown.
|
@ -66,8 +66,8 @@ environment = "lune"
|
||||||
lib = "lib/init.luau"
|
lib = "lib/init.luau"
|
||||||
|
|
||||||
[graph."synpixel/base64"."3.0.1 lune"]
|
[graph."synpixel/base64"."3.0.1 lune"]
|
||||||
direct = ["base64", { name = "synpixel/base64", version = "^3.0.1" }, "standard"]
|
direct = ["base64", { name = "synpixel/base64", version = "^3.0.1" }, "dev"]
|
||||||
resolved_ty = "standard"
|
resolved_ty = "dev"
|
||||||
|
|
||||||
[graph."synpixel/base64"."3.0.1 lune".target]
|
[graph."synpixel/base64"."3.0.1 lune".target]
|
||||||
environment = "lune"
|
environment = "lune"
|
||||||
|
|
Loading…
Add table
Reference in a new issue