Do not multipart-encode the uploaded file.

This commit is contained in:
Cheng Zhao 2013-10-10 18:05:01 +08:00
parent 7f0e7f3835
commit 0ad1fc842d
2 changed files with 7 additions and 11 deletions

View file

@ -24,15 +24,14 @@ class GitHub:
headers['Authorization'] = self._authorization
headers['Accept'] = 'application/vnd.github.manifold-preview'
# Data are sent in JSON format.
if 'data' in kw:
kw['data'] = json.dumps(kw['data'])
# Switch to a different domain for the releases uploading API.
if self._releases_upload_api_pattern.match(path):
url = '%s%s' % (GITHUB_UPLOAD_ASSET_URL, path)
else:
url = '%s%s' % (GITHUB_URL, path)
# Data are sent in JSON format.
if 'data' in kw:
kw['data'] = json.dumps(kw['data'])
r = getattr(requests, method)(url, **kw).json()
if 'message' in r:

View file

@ -134,9 +134,10 @@ def create_release_draft(github, tag):
def upload_atom_shell(github, release_id, file_path):
params = {'name': os.path.basename(file_path)}
headers = {'Content-Type': 'application/zip'}
files = {'file': open(file_path, 'rb')}
github.repos(ATOM_SHELL_REPO).releases(release_id).assets.post(
params=params, headers=headers, files=files, verify=False)
with open(file_path, 'rb') as f:
data = f.read()
github.repos(ATOM_SHELL_REPO).releases(release_id).assets.post(
params=params, headers=headers, data=data, verify=False)
def publish_release(github, release_id):
@ -147,10 +148,6 @@ def publish_release(github, release_id):
def upload_node(bucket, access_key, secret_key, version):
os.chdir(DIST_DIR)
# TODO(zcbenz): Remove me when Atom starts to use Releases API.
s3put(bucket, access_key, secret_key, DIST_DIR,
'atom-shell/{0}'.format(ATOM_SHELL_VRESION), [DIST_NAME])
s3put(bucket, access_key, secret_key, DIST_DIR,
'atom-shell/dist/{0}'.format(version), glob.glob('node-*.tar.gz'))