Do not multipart-encode the uploaded file.
This commit is contained in:
parent
7f0e7f3835
commit
0ad1fc842d
2 changed files with 7 additions and 11 deletions
|
@ -24,15 +24,14 @@ class GitHub:
|
||||||
headers['Authorization'] = self._authorization
|
headers['Authorization'] = self._authorization
|
||||||
headers['Accept'] = 'application/vnd.github.manifold-preview'
|
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.
|
# Switch to a different domain for the releases uploading API.
|
||||||
if self._releases_upload_api_pattern.match(path):
|
if self._releases_upload_api_pattern.match(path):
|
||||||
url = '%s%s' % (GITHUB_UPLOAD_ASSET_URL, path)
|
url = '%s%s' % (GITHUB_UPLOAD_ASSET_URL, path)
|
||||||
else:
|
else:
|
||||||
url = '%s%s' % (GITHUB_URL, path)
|
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()
|
r = getattr(requests, method)(url, **kw).json()
|
||||||
if 'message' in r:
|
if 'message' in r:
|
||||||
|
|
|
@ -134,9 +134,10 @@ def create_release_draft(github, tag):
|
||||||
def upload_atom_shell(github, release_id, file_path):
|
def upload_atom_shell(github, release_id, file_path):
|
||||||
params = {'name': os.path.basename(file_path)}
|
params = {'name': os.path.basename(file_path)}
|
||||||
headers = {'Content-Type': 'application/zip'}
|
headers = {'Content-Type': 'application/zip'}
|
||||||
files = {'file': open(file_path, 'rb')}
|
with open(file_path, 'rb') as f:
|
||||||
|
data = f.read()
|
||||||
github.repos(ATOM_SHELL_REPO).releases(release_id).assets.post(
|
github.repos(ATOM_SHELL_REPO).releases(release_id).assets.post(
|
||||||
params=params, headers=headers, files=files, verify=False)
|
params=params, headers=headers, data=data, verify=False)
|
||||||
|
|
||||||
|
|
||||||
def publish_release(github, release_id):
|
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):
|
def upload_node(bucket, access_key, secret_key, version):
|
||||||
os.chdir(DIST_DIR)
|
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,
|
s3put(bucket, access_key, secret_key, DIST_DIR,
|
||||||
'atom-shell/dist/{0}'.format(version), glob.glob('node-*.tar.gz'))
|
'atom-shell/dist/{0}'.format(version), glob.glob('node-*.tar.gz'))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue