{"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-ora2/pulls/comments/39661758","id":39661758,"diff_hunk":"@@ -29,6 +29,23 @@ class SubmissionMixin(object):\n \n     \"\"\"\n \n+    ALLOWED_IMAGE_MIME_TYPES = ['image/gif', 'image/jpeg', 'image/pjpeg', 'image/png']\n+\n+    ALLOWED_FILE_MIME_TYPES = ['application/pdf'] + ALLOWED_IMAGE_MIME_TYPES\n+\n+    # taken from http://www.howtogeek.com/137270/50-file-extensions-that-are-potentially-dangerous-on-windows/\n+    # and http://pcsupport.about.com/od/tipstricks/a/execfileext.htm\n+    # left out .js and office extensions\n+    FILE_EXT_BLACK_LIST = [\n+        'exe', 'msi', 'app', 'dmg', 'com', 'pif', 'application', 'gadget',\n+        'msp', 'scr', 'hta', 'cpl', 'msc', 'jar', 'bat', 'cmd', 'vb', 'vbs',\n+        'jse', 'ws', 'wsf', 'wsc', 'wsh', 'scf', 'lnk', 'inf', 'reg', 'ps1',\n+        'ps1xml', 'ps2', 'ps2xml', 'psc1', 'psc2', 'msh', 'msh1', 'msh2', 'mshxml',\n+        'msh1xml', 'msh2xml', 'action', 'apk', 'app', 'bin', 'command', 'csh',\n+        'ins', 'inx', 'ipa', 'isu', 'job', 'mst', 'osx', 'out', 'paf', 'prg',\n+        'rgs', 'run', 'sct', 'shb', 'shs', 'u3p', 'vbscript', 'vbe', 'workflow',\n+    ]\n+","path":"openassessment/xblock/submission_mixin.py","position":20,"original_position":20,"commit_id":"52c61281eb5823b95216dc3aa239cfec030777c0","original_commit_id":"52c61281eb5823b95216dc3aa239cfec030777c0","user":{"login":"xcompass","id":465548,"avatar_url":"https://avatars.githubusercontent.com/u/465548?v=3","gravatar_id":"","url":"https://api.github.com/users/xcompass","html_url":"https://github.com/xcompass","followers_url":"https://api.github.com/users/xcompass/followers","following_url":"https://api.github.com/users/xcompass/following{/other_user}","gists_url":"https://api.github.com/users/xcompass/gists{/gist_id}","starred_url":"https://api.github.com/users/xcompass/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xcompass/subscriptions","organizations_url":"https://api.github.com/users/xcompass/orgs","repos_url":"https://api.github.com/users/xcompass/repos","events_url":"https://api.github.com/users/xcompass/events{/privacy}","received_events_url":"https://api.github.com/users/xcompass/received_events","type":"User","site_admin":false},"body":"@lamagnifica  Yes. This is the only place you need to change if you want to edit the blacklist.","created_at":"2015-09-16T17:46:25Z","updated_at":"2015-09-16T17:46:25Z","html_url":"https://github.com/edx/edx-ora2/pull/708#discussion_r39661758","pull_request_url":"https://api.github.com/repos/edx/edx-ora2/pulls/708","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-ora2/pulls/comments/39661758"},"html":{"href":"https://github.com/edx/edx-ora2/pull/708#discussion_r39661758"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-ora2/pulls/708"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-ora2/pulls/708","id":38938460,"html_url":"https://github.com/edx/edx-ora2/pull/708","diff_url":"https://github.com/edx/edx-ora2/pull/708.diff","patch_url":"https://github.com/edx/edx-ora2/pull/708.patch","issue_url":"https://api.github.com/repos/edx/edx-ora2/issues/708","number":708,"state":"open","locked":false,"title":"Allow file upload for PDF and arbitrary file types in addition to image","user":{"login":"xcompass","id":465548,"avatar_url":"https://avatars.githubusercontent.com/u/465548?v=3","gravatar_id":"","url":"https://api.github.com/users/xcompass","html_url":"https://github.com/xcompass","followers_url":"https://api.github.com/users/xcompass/followers","following_url":"https://api.github.com/users/xcompass/following{/other_user}","gists_url":"https://api.github.com/users/xcompass/gists{/gist_id}","starred_url":"https://api.github.com/users/xcompass/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xcompass/subscriptions","organizations_url":"https://api.github.com/users/xcompass/orgs","repos_url":"https://api.github.com/users/xcompass/repos","events_url":"https://api.github.com/users/xcompass/events{/privacy}","received_events_url":"https://api.github.com/users/xcompass/received_events","type":"User","site_admin":false},"body":"This PR is based on Stanford's work for extending uploadable files to more types. The current upload functionality only allows images.\r\n\r\nNow the course author can set \"image\", \"PDF and image\" or \"Custom White List\" file to be allowed to upload along with submission. When \"image\" or \"PDF and image\" file type is selected, the file mime type is checked against a whitelist. When \"Custom White List\" is selected, a white list input box is shown for a list of allowed file extensions. As there is potential for students to upload malicious files, an warning message is printed in the help line. This feature allow instructors to enable students uploading their course work other than images. \r\n\r\nNote: This PR added additional fields to ORA2 XBlock. So \"paver update_db\" is required.\r\nSandbox Link: https://ora-file-upload.sandbox.edx.org/login <--edited to https Alison 15 Sep 15","created_at":"2015-07-01T00:31:00Z","updated_at":"2015-09-16T17:46:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"249536f48e02c419d9e69f0765a1229249ac8735","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-ora2/pulls/708/commits","review_comments_url":"https://api.github.com/repos/edx/edx-ora2/pulls/708/comments","review_comment_url":"https://api.github.com/repos/edx/edx-ora2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edx/edx-ora2/issues/708/comments","statuses_url":"https://api.github.com/repos/edx/edx-ora2/statuses/52c61281eb5823b95216dc3aa239cfec030777c0","head":{"label":"ubc:xcompass/pu/file-upload","ref":"xcompass/pu/file-upload","sha":"52c61281eb5823b95216dc3aa239cfec030777c0","user":{"login":"ubc","id":1396118,"avatar_url":"https://avatars.githubusercontent.com/u/1396118?v=3","gravatar_id":"","url":"https://api.github.com/users/ubc","html_url":"https://github.com/ubc","followers_url":"https://api.github.com/users/ubc/followers","following_url":"https://api.github.com/users/ubc/following{/other_user}","gists_url":"https://api.github.com/users/ubc/gists{/gist_id}","starred_url":"https://api.github.com/users/ubc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ubc/subscriptions","organizations_url":"https://api.github.com/users/ubc/orgs","repos_url":"https://api.github.com/users/ubc/repos","events_url":"https://api.github.com/users/ubc/events{/privacy}","received_events_url":"https://api.github.com/users/ubc/received_events","type":"Organization","site_admin":false},"repo":{"id":33887562,"name":"edx-ora2","full_name":"ubc/edx-ora2","owner":{"login":"ubc","id":1396118,"avatar_url":"https://avatars.githubusercontent.com/u/1396118?v=3","gravatar_id":"","url":"https://api.github.com/users/ubc","html_url":"https://github.com/ubc","followers_url":"https://api.github.com/users/ubc/followers","following_url":"https://api.github.com/users/ubc/following{/other_user}","gists_url":"https://api.github.com/users/ubc/gists{/gist_id}","starred_url":"https://api.github.com/users/ubc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ubc/subscriptions","organizations_url":"https://api.github.com/users/ubc/orgs","repos_url":"https://api.github.com/users/ubc/repos","events_url":"https://api.github.com/users/ubc/events{/privacy}","received_events_url":"https://api.github.com/users/ubc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ubc/edx-ora2","description":"Open Response Assessment Suite","fork":true,"url":"https://api.github.com/repos/ubc/edx-ora2","forks_url":"https://api.github.com/repos/ubc/edx-ora2/forks","keys_url":"https://api.github.com/repos/ubc/edx-ora2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ubc/edx-ora2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ubc/edx-ora2/teams","hooks_url":"https://api.github.com/repos/ubc/edx-ora2/hooks","issue_events_url":"https://api.github.com/repos/ubc/edx-ora2/issues/events{/number}","events_url":"https://api.github.com/repos/ubc/edx-ora2/events","assignees_url":"https://api.github.com/repos/ubc/edx-ora2/assignees{/user}","branches_url":"https://api.github.com/repos/ubc/edx-ora2/branches{/branch}","tags_url":"https://api.github.com/repos/ubc/edx-ora2/tags","blobs_url":"https://api.github.com/repos/ubc/edx-ora2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ubc/edx-ora2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ubc/edx-ora2/git/refs{/sha}","trees_url":"https://api.github.com/repos/ubc/edx-ora2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ubc/edx-ora2/statuses/{sha}","languages_url":"https://api.github.com/repos/ubc/edx-ora2/languages","stargazers_url":"https://api.github.com/repos/ubc/edx-ora2/stargazers","contributors_url":"https://api.github.com/repos/ubc/edx-ora2/contributors","subscribers_url":"https://api.github.com/repos/ubc/edx-ora2/subscribers","subscription_url":"https://api.github.com/repos/ubc/edx-ora2/subscription","commits_url":"https://api.github.com/repos/ubc/edx-ora2/commits{/sha}","git_commits_url":"https://api.github.com/repos/ubc/edx-ora2/git/commits{/sha}","comments_url":"https://api.github.com/repos/ubc/edx-ora2/comments{/number}","issue_comment_url":"https://api.github.com/repos/ubc/edx-ora2/issues/comments{/number}","contents_url":"https://api.github.com/repos/ubc/edx-ora2/contents/{+path}","compare_url":"https://api.github.com/repos/ubc/edx-ora2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ubc/edx-ora2/merges","archive_url":"https://api.github.com/repos/ubc/edx-ora2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ubc/edx-ora2/downloads","issues_url":"https://api.github.com/repos/ubc/edx-ora2/issues{/number}","pulls_url":"https://api.github.com/repos/ubc/edx-ora2/pulls{/number}","milestones_url":"https://api.github.com/repos/ubc/edx-ora2/milestones{/number}","notifications_url":"https://api.github.com/repos/ubc/edx-ora2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ubc/edx-ora2/labels{/name}","releases_url":"https://api.github.com/repos/ubc/edx-ora2/releases{/id}","created_at":"2015-04-13T18:57:40Z","updated_at":"2015-04-13T18:57:43Z","pushed_at":"2015-09-13T22:00:41Z","git_url":"git://github.com/ubc/edx-ora2.git","ssh_url":"git@github.com:ubc/edx-ora2.git","clone_url":"https://github.com/ubc/edx-ora2.git","svn_url":"https://github.com/ubc/edx-ora2","homepage":"","size":68168,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"da015d5f4a7b8682f351df1d07a920751d6f50f5","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":15404425,"name":"edx-ora2","full_name":"edx/edx-ora2","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-ora2","description":"Open Response Assessment Suite","fork":false,"url":"https://api.github.com/repos/edx/edx-ora2","forks_url":"https://api.github.com/repos/edx/edx-ora2/forks","keys_url":"https://api.github.com/repos/edx/edx-ora2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-ora2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-ora2/teams","hooks_url":"https://api.github.com/repos/edx/edx-ora2/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-ora2/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-ora2/events","assignees_url":"https://api.github.com/repos/edx/edx-ora2/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-ora2/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-ora2/tags","blobs_url":"https://api.github.com/repos/edx/edx-ora2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-ora2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-ora2/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-ora2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-ora2/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-ora2/languages","stargazers_url":"https://api.github.com/repos/edx/edx-ora2/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-ora2/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-ora2/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-ora2/subscription","commits_url":"https://api.github.com/repos/edx/edx-ora2/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-ora2/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-ora2/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-ora2/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/edx-ora2/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-ora2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-ora2/merges","archive_url":"https://api.github.com/repos/edx/edx-ora2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-ora2/downloads","issues_url":"https://api.github.com/repos/edx/edx-ora2/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-ora2/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-ora2/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-ora2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-ora2/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-ora2/releases{/id}","created_at":"2013-12-23T20:54:54Z","updated_at":"2015-09-14T07:02:42Z","pushed_at":"2015-09-16T15:28:09Z","git_url":"git://github.com/edx/edx-ora2.git","ssh_url":"git@github.com:edx/edx-ora2.git","clone_url":"https://github.com/edx/edx-ora2.git","svn_url":"https://github.com/edx/edx-ora2","homepage":"","size":114443,"stargazers_count":26,"watchers_count":26,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":69,"mirror_url":null,"open_issues_count":10,"forks":69,"open_issues":10,"watchers":26,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-ora2/pulls/708"},"html":{"href":"https://github.com/edx/edx-ora2/pull/708"},"issue":{"href":"https://api.github.com/repos/edx/edx-ora2/issues/708"},"comments":{"href":"https://api.github.com/repos/edx/edx-ora2/issues/708/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-ora2/pulls/708/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/edx-ora2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edx/edx-ora2/pulls/708/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-ora2/statuses/52c61281eb5823b95216dc3aa239cfec030777c0"}}}}