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

Fix upload of base64 encoded files. #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions octokit.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -791,15 +791,17 @@ makeOctokit = (newPromise, allPromises, XMLHttpRequest, base64encode, userAgent)
# Post a new blob object, getting a blob SHA back
# -------
@postBlob = (content, isBase64) ->
if typeof (content) is 'string'
# Base64 encode the content if it is binary (isBase64)
content = base64encode(content) if isBase64

if isBase64
content =
content: content
encoding: 'utf-8'

content.encoding = 'base64' if isBase64
content: content,
encoding: 'base64'
else
if typeof (content) is 'string'
# Base64 encode the content if it is binary (isBase64)
content = base64encode(content) if isBase64
content =
content: content
encoding: 'utf-8'

_request('POST', "#{_repoPath}/git/blobs", content)
.then (res) =>
Expand Down
20 changes: 12 additions & 8 deletions octokit.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.