Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect base64 format #64

Open
ultradian opened this issue Mar 31, 2017 · 0 comments
Open

incorrect base64 format #64

ultradian opened this issue Mar 31, 2017 · 0 comments

Comments

@ultradian
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant