incorrect base64 format
- Dominant language
- Julia
- Stars
- 175
- Forks
- 62
- PR merge metrics
- No merged PRs in 30d
Description
I was using `GitHub.file()` to download some of the `url` files from `Metadata.jl` and found some did not `base64decode` correctly. Example:
`file("JuliaLang/METADATA.jl", "ACME/url")`
produces
```
GitHub.Content (all fields are Nullable):
typ: "file"
name: "url"
path: "ACME/url"
encoding: "base64"
content: "Z2l0Oi8vZ2l0aHViLmNvbS9IU1UtQU5UL0FDTUUuamwuZ2l0Cg==\n"
sha: "b5b82f0d5f1f349298b604abd2f1f6e77ca1ae64"
...
```
but
`file("JuliaLang/METADATA.jl", "AWS/url").content.value`
gives
`"Z2l0Oi8vZ2l0aHViLmNvbS9KdWxpYUNsb3VkL0FXUy5qbC5naXQK\n"`
and
```
base64decode("Z2l0Oi8vZ2l0aHViLmNvbS9KdWxpYUNsb3VkL0FXUy5qbC5naXQK\n")
ArgumentError: incorrect base64 format, block must be at least 2 and at most 4 bytes
in b64decode!(::Array{UInt8,1}, ::Array{UInt8,1}) at ./base64.jl:68
in read(::Base64DecodePipe, ::Type{UInt8}) at ./base64.jl:192
in readbytes!(::Base64DecodePipe, ::Array{UInt8,1}, ::Int64) at ./io.jl:345
in read(::Base64DecodePipe, ::Int64) at ./io.jl:368
in base64decode(::String) at ./base64.jl:203
```
Out of the 1000 files I downloaded, about a third gave this error. I'm not sure if this is an issue with how the Content gets parsed internally and need something deeper. For my own purposes, I just fixed the strings by adding a `=` before the `\n`.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the GitHub.file() entry point and the Content parsing path, then reproduce the failure with the ACME/url and AWS/url examples from the issue. Trace how the returned base64 content is handled; done means these examples decode successfully without the incorrect base64 format error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 42/100