mirror of
https://github.com/asciinema/asciinema.git
synced 2026-04-25 16:05:52 +03:00
[GH-ISSUE #364] ValueError: Invalid header value b'Basic <ConsumerKey>', error when uploading the local cast #845
Labels
No labels
bug
compatibility
feature request
fit for beginners
help wanted
hosting
idea
improvement
packaging
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/asciinema#845
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mochadwi on GitHub (Jul 24, 2019).
Original GitHub issue: https://github.com/asciinema/asciinema/issues/364
I'm trying to upload the local cast, but below error is thrown instead.
Here's the error.
@ku1ik commented on GitHub (Sep 8, 2019):
Are you still experiencing this? Is it the same when you
asciinema rec(rec+upload in one go) vsasciinema rec demo.cast+asciinema upload demo.cast?@Kikobeats commented on GitHub (Jun 25, 2020):
same issue here, one year later
@vladimirkuvanovv commented on GitHub (Jun 28, 2020):
I have the same issue too
@gingermusketeer commented on GitHub (Sep 19, 2021):
I was able to get around this issue by changing this line to :
@sriumcp commented on GitHub (Oct 1, 2021):
The solution from @gingermusketeer looks right. HTTP headers are indeed supposed to be
asciiencoded. Any chance of this fix making it into a release soon?I love asciinema and was eagerly looking forward to use this until I was bitten by this bug!
@ku1ik commented on GitHub (Oct 2, 2021):
Thanks for digging into this. However it's not about utf-8 vs ascii. Base64 encoding always produces ascii output, regardles of the input.
I figured out it's about the length of the input. Given the password here is the locally generated UUID v4, which is fixed-length, it must be the length of the username, which is taken from
$USERenv var.I tested it and in fact username longer than 20 chars causes
ValueError: Invalid header value b'Basic ...'error.Turns out
base64.encodebytesreturn bytes containing the base64-encoded data, with newlines (b'\n') inserted after every 76 bytes of output (see https://docs.python.org/3/library/base64.html#base64.encodebytes). That extra newline inside the header value is the problem.base64.b64encodedoesn't do line breaks, that's why it works. I tested it with utf-8 and it does the job:I'll release a patch shortly.
@gingermusketeer commented on GitHub (Oct 2, 2021):
Thanks a lot @sickill !