HBASE-19032 Set mimetype for patches uploaded by submit-patch.py

Change-Id: I38e6417dddd4e2525cd6a929922b2612c91d660d


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/5368fd5b
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/5368fd5b
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/5368fd5b

Branch: refs/heads/HBASE-18410
Commit: 5368fd5bf0a281e67c4dde25816a1362d1f0a3f0
Parents: 41cc9a1
Author: Apekshit Sharma <a...@apache.org>
Authored: Tue Oct 17 15:32:39 2017 -0700
Committer: Apekshit Sharma <a...@apache.org>
Committed: Tue Oct 17 15:43:07 2017 -0700

----------------------------------------------------------------------
 dev-support/submit-patch.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/5368fd5b/dev-support/submit-patch.py
----------------------------------------------------------------------
diff --git a/dev-support/submit-patch.py b/dev-support/submit-patch.py
index 577be52..ad39495 100755
--- a/dev-support/submit-patch.py
+++ b/dev-support/submit-patch.py
@@ -205,12 +205,12 @@ def get_credentials():
     return creds
 
 
-def attach_patch_to_jira(issue_url, patch_filepath, creds):
+def attach_patch_to_jira(issue_url, patch_filepath, patch_filename, creds):
     # Upload patch to jira using REST API.
     headers = {'X-Atlassian-Token': 'no-check'}
-    files = {'file': open(patch_filepath, 'rb')}
+    files = {'file': (patch_filename, open(patch_filepath, 'rb'), 
'text/plain')}
     jira_auth = requests.auth.HTTPBasicAuth(creds['jira_username'], 
creds['jira_password'])
-    attachment_url = issue_url +  "/attachments"
+    attachment_url = issue_url + "/attachments"
     r = requests.post(attachment_url, headers = headers, files = files, auth = 
jira_auth)
     assert_status_code(r, 200, "uploading patch to jira")
 
@@ -256,7 +256,7 @@ if args.jira_id is not None:
     creds = get_credentials()
     issue_url = "https://issues.apache.org/jira/rest/api/2/issue/"; + 
args.jira_id
 
-    attach_patch_to_jira(issue_url, patch_filepath, creds)
+    attach_patch_to_jira(issue_url, patch_filepath, patch_filename, creds)
 
     if not args.skip_review_board:
         rb_auth = requests.auth.HTTPBasicAuth(creds['rb_username'], 
creds['rb_password'])

Reply via email to