{"action":"created","comment":{"url":"https://api.github.com/repos/girder/girder/pulls/comments/56336036","id":56336036,"diff_hunk":"@@ -486,6 +486,60 @@ def uploadFileToItem(self, itemId, filepath, reference=None):\n                                 ' not receive object with _id. Got instead: ' +\n                                 json.dumps(obj))\n \n+    \"\"\"\n+        Uploads contents of a file\n+\n+        :param uploadObj: The upload object contain the upload id.\n+        :type uploadObj: dict\n+        :param stream: Readable stream object.\n+        :type stream: file-like\n+        :param size: The length of the file. This must be exactly equal to the\n+            total number of bytes that will be read from ``stream``, otherwise\n+            the upload will fail.\n+        :type size: str\n+        :param progressCallback: If passed, will be called after each chunk\n+            with progress information. It passes a single positional argument\n+            to the callable which is a dict of information about progress.\n+        :type progressCallback: callable\n+    \"\"\"\n+    def _uploadContents(self, uploadObj, stream, size, progressCallback=None):\n+        offset = 0\n+        uploadId = uploadObj['_id']\n+        while True:\n+            data = stream.read(self.MAX_CHUNK_SIZE)","path":"clients/python/girder_client/__init__.py","position":24,"original_position":24,"commit_id":"14925939e27cb196a2474bd26a9f7af5d2efc572","original_commit_id":"14925939e27cb196a2474bd26a9f7af5d2efc572","user":{"login":"mgrauer","id":595023,"avatar_url":"https://avatars.githubusercontent.com/u/595023?v=3","gravatar_id":"","url":"https://api.github.com/users/mgrauer","html_url":"https://github.com/mgrauer","followers_url":"https://api.github.com/users/mgrauer/followers","following_url":"https://api.github.com/users/mgrauer/following{/other_user}","gists_url":"https://api.github.com/users/mgrauer/gists{/gist_id}","starred_url":"https://api.github.com/users/mgrauer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgrauer/subscriptions","organizations_url":"https://api.github.com/users/mgrauer/orgs","repos_url":"https://api.github.com/users/mgrauer/repos","events_url":"https://api.github.com/users/mgrauer/events{/privacy}","received_events_url":"https://api.github.com/users/mgrauer/received_events","type":"User","site_admin":false},"body":"@cjh1 \r\n\r\nThis concerns me, a small amount anyway.  I realize it was here before and just got moved.\r\n\r\nIf a stream is passed with more bytes than `size`, we'll potentially read more than `size`.  \r\n\r\nShould this be something like\r\n\r\n    data = stream.read(min(self.MAX_CHUNK_SIZE, (size - offset)))\r\n\r\n?","created_at":"2016-03-16T13:53:46Z","updated_at":"2016-03-16T13:53:46Z","html_url":"https://github.com/girder/girder/pull/1274#discussion_r56336036","pull_request_url":"https://api.github.com/repos/girder/girder/pulls/1274","_links":{"self":{"href":"https://api.github.com/repos/girder/girder/pulls/comments/56336036"},"html":{"href":"https://github.com/girder/girder/pull/1274#discussion_r56336036"},"pull_request":{"href":"https://api.github.com/repos/girder/girder/pulls/1274"}}},"pull_request":{"url":"https://api.github.com/repos/girder/girder/pulls/1274","id":62897752,"html_url":"https://github.com/girder/girder/pull/1274","diff_url":"https://github.com/girder/girder/pull/1274.diff","patch_url":"https://github.com/girder/girder/pull/1274.patch","issue_url":"https://api.github.com/repos/girder/girder/issues/1274","number":1274,"state":"open","locked":false,"title":"Add method to upload content to existing file","user":{"login":"cjh1","id":1031053,"avatar_url":"https://avatars.githubusercontent.com/u/1031053?v=3","gravatar_id":"","url":"https://api.github.com/users/cjh1","html_url":"https://github.com/cjh1","followers_url":"https://api.github.com/users/cjh1/followers","following_url":"https://api.github.com/users/cjh1/following{/other_user}","gists_url":"https://api.github.com/users/cjh1/gists{/gist_id}","starred_url":"https://api.github.com/users/cjh1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjh1/subscriptions","organizations_url":"https://api.github.com/users/cjh1/orgs","repos_url":"https://api.github.com/users/cjh1/repos","events_url":"https://api.github.com/users/cjh1/events{/privacy}","received_events_url":"https://api.github.com/users/cjh1/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-03-15T12:29:01Z","updated_at":"2016-03-16T13:53:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"65894736cf40235e6b000cbb5868ddfc12846601","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/girder/girder/pulls/1274/commits","review_comments_url":"https://api.github.com/repos/girder/girder/pulls/1274/comments","review_comment_url":"https://api.github.com/repos/girder/girder/pulls/comments{/number}","comments_url":"https://api.github.com/repos/girder/girder/issues/1274/comments","statuses_url":"https://api.github.com/repos/girder/girder/statuses/14925939e27cb196a2474bd26a9f7af5d2efc572","head":{"label":"girder:client-upload","ref":"client-upload","sha":"14925939e27cb196a2474bd26a9f7af5d2efc572","user":{"login":"girder","id":5150517,"avatar_url":"https://avatars.githubusercontent.com/u/5150517?v=3","gravatar_id":"","url":"https://api.github.com/users/girder","html_url":"https://github.com/girder","followers_url":"https://api.github.com/users/girder/followers","following_url":"https://api.github.com/users/girder/following{/other_user}","gists_url":"https://api.github.com/users/girder/gists{/gist_id}","starred_url":"https://api.github.com/users/girder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/girder/subscriptions","organizations_url":"https://api.github.com/users/girder/orgs","repos_url":"https://api.github.com/users/girder/repos","events_url":"https://api.github.com/users/girder/events{/privacy}","received_events_url":"https://api.github.com/users/girder/received_events","type":"Organization","site_admin":false},"repo":{"id":11854950,"name":"girder","full_name":"girder/girder","owner":{"login":"girder","id":5150517,"avatar_url":"https://avatars.githubusercontent.com/u/5150517?v=3","gravatar_id":"","url":"https://api.github.com/users/girder","html_url":"https://github.com/girder","followers_url":"https://api.github.com/users/girder/followers","following_url":"https://api.github.com/users/girder/following{/other_user}","gists_url":"https://api.github.com/users/girder/gists{/gist_id}","starred_url":"https://api.github.com/users/girder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/girder/subscriptions","organizations_url":"https://api.github.com/users/girder/orgs","repos_url":"https://api.github.com/users/girder/repos","events_url":"https://api.github.com/users/girder/events{/privacy}","received_events_url":"https://api.github.com/users/girder/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/girder/girder","description":"A data management platform for the web","fork":false,"url":"https://api.github.com/repos/girder/girder","forks_url":"https://api.github.com/repos/girder/girder/forks","keys_url":"https://api.github.com/repos/girder/girder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/girder/girder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/girder/girder/teams","hooks_url":"https://api.github.com/repos/girder/girder/hooks","issue_events_url":"https://api.github.com/repos/girder/girder/issues/events{/number}","events_url":"https://api.github.com/repos/girder/girder/events","assignees_url":"https://api.github.com/repos/girder/girder/assignees{/user}","branches_url":"https://api.github.com/repos/girder/girder/branches{/branch}","tags_url":"https://api.github.com/repos/girder/girder/tags","blobs_url":"https://api.github.com/repos/girder/girder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/girder/girder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/girder/girder/git/refs{/sha}","trees_url":"https://api.github.com/repos/girder/girder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/girder/girder/statuses/{sha}","languages_url":"https://api.github.com/repos/girder/girder/languages","stargazers_url":"https://api.github.com/repos/girder/girder/stargazers","contributors_url":"https://api.github.com/repos/girder/girder/contributors","subscribers_url":"https://api.github.com/repos/girder/girder/subscribers","subscription_url":"https://api.github.com/repos/girder/girder/subscription","commits_url":"https://api.github.com/repos/girder/girder/commits{/sha}","git_commits_url":"https://api.github.com/repos/girder/girder/git/commits{/sha}","comments_url":"https://api.github.com/repos/girder/girder/comments{/number}","issue_comment_url":"https://api.github.com/repos/girder/girder/issues/comments{/number}","contents_url":"https://api.github.com/repos/girder/girder/contents/{+path}","compare_url":"https://api.github.com/repos/girder/girder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/girder/girder/merges","archive_url":"https://api.github.com/repos/girder/girder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/girder/girder/downloads","issues_url":"https://api.github.com/repos/girder/girder/issues{/number}","pulls_url":"https://api.github.com/repos/girder/girder/pulls{/number}","milestones_url":"https://api.github.com/repos/girder/girder/milestones{/number}","notifications_url":"https://api.github.com/repos/girder/girder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/girder/girder/labels{/name}","releases_url":"https://api.github.com/repos/girder/girder/releases{/id}","deployments_url":"https://api.github.com/repos/girder/girder/deployments","created_at":"2013-08-02T23:55:54Z","updated_at":"2016-03-06T12:53:10Z","pushed_at":"2016-03-16T13:33:17Z","git_url":"git://github.com/girder/girder.git","ssh_url":"git@github.com:girder/girder.git","clone_url":"https://github.com/girder/girder.git","svn_url":"https://github.com/girder/girder","homepage":"http://girder.readthedocs.org","size":7556,"stargazers_count":42,"watchers_count":42,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":36,"mirror_url":null,"open_issues_count":164,"forks":36,"open_issues":164,"watchers":42,"default_branch":"master"}},"base":{"label":"girder:master","ref":"master","sha":"d8d8d70ec5de85b74014b1478c541a3c5aa67878","user":{"login":"girder","id":5150517,"avatar_url":"https://avatars.githubusercontent.com/u/5150517?v=3","gravatar_id":"","url":"https://api.github.com/users/girder","html_url":"https://github.com/girder","followers_url":"https://api.github.com/users/girder/followers","following_url":"https://api.github.com/users/girder/following{/other_user}","gists_url":"https://api.github.com/users/girder/gists{/gist_id}","starred_url":"https://api.github.com/users/girder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/girder/subscriptions","organizations_url":"https://api.github.com/users/girder/orgs","repos_url":"https://api.github.com/users/girder/repos","events_url":"https://api.github.com/users/girder/events{/privacy}","received_events_url":"https://api.github.com/users/girder/received_events","type":"Organization","site_admin":false},"repo":{"id":11854950,"name":"girder","full_name":"girder/girder","owner":{"login":"girder","id":5150517,"avatar_url":"https://avatars.githubusercontent.com/u/5150517?v=3","gravatar_id":"","url":"https://api.github.com/users/girder","html_url":"https://github.com/girder","followers_url":"https://api.github.com/users/girder/followers","following_url":"https://api.github.com/users/girder/following{/other_user}","gists_url":"https://api.github.com/users/girder/gists{/gist_id}","starred_url":"https://api.github.com/users/girder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/girder/subscriptions","organizations_url":"https://api.github.com/users/girder/orgs","repos_url":"https://api.github.com/users/girder/repos","events_url":"https://api.github.com/users/girder/events{/privacy}","received_events_url":"https://api.github.com/users/girder/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/girder/girder","description":"A data management platform for the web","fork":false,"url":"https://api.github.com/repos/girder/girder","forks_url":"https://api.github.com/repos/girder/girder/forks","keys_url":"https://api.github.com/repos/girder/girder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/girder/girder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/girder/girder/teams","hooks_url":"https://api.github.com/repos/girder/girder/hooks","issue_events_url":"https://api.github.com/repos/girder/girder/issues/events{/number}","events_url":"https://api.github.com/repos/girder/girder/events","assignees_url":"https://api.github.com/repos/girder/girder/assignees{/user}","branches_url":"https://api.github.com/repos/girder/girder/branches{/branch}","tags_url":"https://api.github.com/repos/girder/girder/tags","blobs_url":"https://api.github.com/repos/girder/girder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/girder/girder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/girder/girder/git/refs{/sha}","trees_url":"https://api.github.com/repos/girder/girder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/girder/girder/statuses/{sha}","languages_url":"https://api.github.com/repos/girder/girder/languages","stargazers_url":"https://api.github.com/repos/girder/girder/stargazers","contributors_url":"https://api.github.com/repos/girder/girder/contributors","subscribers_url":"https://api.github.com/repos/girder/girder/subscribers","subscription_url":"https://api.github.com/repos/girder/girder/subscription","commits_url":"https://api.github.com/repos/girder/girder/commits{/sha}","git_commits_url":"https://api.github.com/repos/girder/girder/git/commits{/sha}","comments_url":"https://api.github.com/repos/girder/girder/comments{/number}","issue_comment_url":"https://api.github.com/repos/girder/girder/issues/comments{/number}","contents_url":"https://api.github.com/repos/girder/girder/contents/{+path}","compare_url":"https://api.github.com/repos/girder/girder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/girder/girder/merges","archive_url":"https://api.github.com/repos/girder/girder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/girder/girder/downloads","issues_url":"https://api.github.com/repos/girder/girder/issues{/number}","pulls_url":"https://api.github.com/repos/girder/girder/pulls{/number}","milestones_url":"https://api.github.com/repos/girder/girder/milestones{/number}","notifications_url":"https://api.github.com/repos/girder/girder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/girder/girder/labels{/name}","releases_url":"https://api.github.com/repos/girder/girder/releases{/id}","deployments_url":"https://api.github.com/repos/girder/girder/deployments","created_at":"2013-08-02T23:55:54Z","updated_at":"2016-03-06T12:53:10Z","pushed_at":"2016-03-16T13:33:17Z","git_url":"git://github.com/girder/girder.git","ssh_url":"git@github.com:girder/girder.git","clone_url":"https://github.com/girder/girder.git","svn_url":"https://github.com/girder/girder","homepage":"http://girder.readthedocs.org","size":7556,"stargazers_count":42,"watchers_count":42,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":36,"mirror_url":null,"open_issues_count":164,"forks":36,"open_issues":164,"watchers":42,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/girder/girder/pulls/1274"},"html":{"href":"https://github.com/girder/girder/pull/1274"},"issue":{"href":"https://api.github.com/repos/girder/girder/issues/1274"},"comments":{"href":"https://api.github.com/repos/girder/girder/issues/1274/comments"},"review_comments":{"href":"https://api.github.com/repos/girder/girder/pulls/1274/comments"},"review_comment":{"href":"https://api.github.com/repos/girder/girder/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/girder/girder/pulls/1274/commits"},"statuses":{"href":"https://api.github.com/repos/girder/girder/statuses/14925939e27cb196a2474bd26a9f7af5d2efc572"}}}}