{"action":"created","comment":{"url":"https://api.github.com/repos/pahaz/test1/pulls/comments/28203918","id":28203918,"diff_hunk":"@@ -35,14 +45,30 @@ def application(environ, start_response):\n \n     if URI_PATH.startswith(STATIC_URL):\n         print('STATIC FILE DETECTED!')\n+        print(URI_PATH)\n+        file = str(URI_PATH).replace(STATIC_URL, \"\", 1)\n+        requested_path = os.path.join(startdir, file)\n+        requested_path = os.path.abspath(requested_path)\n+        print(requested_path)\n+        if not requested_path.startswith(startdir):\n+            raise OSError(\"Hack\")\n+        headers[0] = ('Content-type', mimetypes.guess_type(URI_PATH, strict=True)[0]+'; charset=utf-8')\n+        try:\n+            f = open(requested_path, 'rb')\n+        except FileExistsError:\n+            status = '404 Not Found'","path":"wsgi.py","position":42,"original_position":42,"commit_id":"68b7ba18141786c813eea280da1f7d89a4d040e6","original_commit_id":"68b7ba18141786c813eea280da1f7d89a4d040e6","user":{"login":"pahaz","id":1394025,"avatar_url":"https://avatars.githubusercontent.com/u/1394025?v=3","gravatar_id":"","url":"https://api.github.com/users/pahaz","html_url":"https://github.com/pahaz","followers_url":"https://api.github.com/users/pahaz/followers","following_url":"https://api.github.com/users/pahaz/following{/other_user}","gists_url":"https://api.github.com/users/pahaz/gists{/gist_id}","starred_url":"https://api.github.com/users/pahaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pahaz/subscriptions","organizations_url":"https://api.github.com/users/pahaz/orgs","repos_url":"https://api.github.com/users/pahaz/repos","events_url":"https://api.github.com/users/pahaz/events{/privacy}","received_events_url":"https://api.github.com/users/pahaz/received_events","type":"User","site_admin":false},"body":"If FileExistsError be raised then you change status to 404, after that you change status to 200 and do `body = f.read()` file. I think this is the wrong behavior.","created_at":"2015-04-12T14:34:53Z","updated_at":"2015-04-12T14:34:53Z","html_url":"https://github.com/pahaz/test1/pull/11#discussion_r28203918","pull_request_url":"https://api.github.com/repos/pahaz/test1/pulls/11","_links":{"self":{"href":"https://api.github.com/repos/pahaz/test1/pulls/comments/28203918"},"html":{"href":"https://github.com/pahaz/test1/pull/11#discussion_r28203918"},"pull_request":{"href":"https://api.github.com/repos/pahaz/test1/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/pahaz/test1/pulls/11","id":32516447,"html_url":"https://github.com/pahaz/test1/pull/11","diff_url":"https://github.com/pahaz/test1/pull/11.diff","patch_url":"https://github.com/pahaz/test1/pull/11.patch","issue_url":"https://api.github.com/repos/pahaz/test1/issues/11","number":11,"state":"open","locked":false,"title":"Homework","user":{"login":"Tanyusha","id":5334201,"avatar_url":"https://avatars.githubusercontent.com/u/5334201?v=3","gravatar_id":"","url":"https://api.github.com/users/Tanyusha","html_url":"https://github.com/Tanyusha","followers_url":"https://api.github.com/users/Tanyusha/followers","following_url":"https://api.github.com/users/Tanyusha/following{/other_user}","gists_url":"https://api.github.com/users/Tanyusha/gists{/gist_id}","starred_url":"https://api.github.com/users/Tanyusha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tanyusha/subscriptions","organizations_url":"https://api.github.com/users/Tanyusha/orgs","repos_url":"https://api.github.com/users/Tanyusha/repos","events_url":"https://api.github.com/users/Tanyusha/events{/privacy}","received_events_url":"https://api.github.com/users/Tanyusha/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-04-02T14:31:11Z","updated_at":"2015-04-12T14:34:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3a7dadd1e96dbe656e9fb506be54734699350809","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pahaz/test1/pulls/11/commits","review_comments_url":"https://api.github.com/repos/pahaz/test1/pulls/11/comments","review_comment_url":"https://api.github.com/repos/pahaz/test1/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pahaz/test1/issues/11/comments","statuses_url":"https://api.github.com/repos/pahaz/test1/statuses/68b7ba18141786c813eea280da1f7d89a4d040e6","head":{"label":"Tanyusha:master","ref":"master","sha":"68b7ba18141786c813eea280da1f7d89a4d040e6","user":{"login":"Tanyusha","id":5334201,"avatar_url":"https://avatars.githubusercontent.com/u/5334201?v=3","gravatar_id":"","url":"https://api.github.com/users/Tanyusha","html_url":"https://github.com/Tanyusha","followers_url":"https://api.github.com/users/Tanyusha/followers","following_url":"https://api.github.com/users/Tanyusha/following{/other_user}","gists_url":"https://api.github.com/users/Tanyusha/gists{/gist_id}","starred_url":"https://api.github.com/users/Tanyusha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tanyusha/subscriptions","organizations_url":"https://api.github.com/users/Tanyusha/orgs","repos_url":"https://api.github.com/users/Tanyusha/repos","events_url":"https://api.github.com/users/Tanyusha/events{/privacy}","received_events_url":"https://api.github.com/users/Tanyusha/received_events","type":"User","site_admin":false},"repo":{"id":32999224,"name":"test1","full_name":"Tanyusha/test1","owner":{"login":"Tanyusha","id":5334201,"avatar_url":"https://avatars.githubusercontent.com/u/5334201?v=3","gravatar_id":"","url":"https://api.github.com/users/Tanyusha","html_url":"https://github.com/Tanyusha","followers_url":"https://api.github.com/users/Tanyusha/followers","following_url":"https://api.github.com/users/Tanyusha/following{/other_user}","gists_url":"https://api.github.com/users/Tanyusha/gists{/gist_id}","starred_url":"https://api.github.com/users/Tanyusha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tanyusha/subscriptions","organizations_url":"https://api.github.com/users/Tanyusha/orgs","repos_url":"https://api.github.com/users/Tanyusha/repos","events_url":"https://api.github.com/users/Tanyusha/events{/privacy}","received_events_url":"https://api.github.com/users/Tanyusha/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Tanyusha/test1","description":"MVC EXAMPLE","fork":true,"url":"https://api.github.com/repos/Tanyusha/test1","forks_url":"https://api.github.com/repos/Tanyusha/test1/forks","keys_url":"https://api.github.com/repos/Tanyusha/test1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Tanyusha/test1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Tanyusha/test1/teams","hooks_url":"https://api.github.com/repos/Tanyusha/test1/hooks","issue_events_url":"https://api.github.com/repos/Tanyusha/test1/issues/events{/number}","events_url":"https://api.github.com/repos/Tanyusha/test1/events","assignees_url":"https://api.github.com/repos/Tanyusha/test1/assignees{/user}","branches_url":"https://api.github.com/repos/Tanyusha/test1/branches{/branch}","tags_url":"https://api.github.com/repos/Tanyusha/test1/tags","blobs_url":"https://api.github.com/repos/Tanyusha/test1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Tanyusha/test1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Tanyusha/test1/git/refs{/sha}","trees_url":"https://api.github.com/repos/Tanyusha/test1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Tanyusha/test1/statuses/{sha}","languages_url":"https://api.github.com/repos/Tanyusha/test1/languages","stargazers_url":"https://api.github.com/repos/Tanyusha/test1/stargazers","contributors_url":"https://api.github.com/repos/Tanyusha/test1/contributors","subscribers_url":"https://api.github.com/repos/Tanyusha/test1/subscribers","subscription_url":"https://api.github.com/repos/Tanyusha/test1/subscription","commits_url":"https://api.github.com/repos/Tanyusha/test1/commits{/sha}","git_commits_url":"https://api.github.com/repos/Tanyusha/test1/git/commits{/sha}","comments_url":"https://api.github.com/repos/Tanyusha/test1/comments{/number}","issue_comment_url":"https://api.github.com/repos/Tanyusha/test1/issues/comments{/number}","contents_url":"https://api.github.com/repos/Tanyusha/test1/contents/{+path}","compare_url":"https://api.github.com/repos/Tanyusha/test1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Tanyusha/test1/merges","archive_url":"https://api.github.com/repos/Tanyusha/test1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Tanyusha/test1/downloads","issues_url":"https://api.github.com/repos/Tanyusha/test1/issues{/number}","pulls_url":"https://api.github.com/repos/Tanyusha/test1/pulls{/number}","milestones_url":"https://api.github.com/repos/Tanyusha/test1/milestones{/number}","notifications_url":"https://api.github.com/repos/Tanyusha/test1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Tanyusha/test1/labels{/name}","releases_url":"https://api.github.com/repos/Tanyusha/test1/releases{/id}","created_at":"2015-03-27T17:14:26Z","updated_at":"2015-04-02T14:29:55Z","pushed_at":"2015-04-02T14:29:55Z","git_url":"git://github.com/Tanyusha/test1.git","ssh_url":"git@github.com:Tanyusha/test1.git","clone_url":"https://github.com/Tanyusha/test1.git","svn_url":"https://github.com/Tanyusha/test1","homepage":"","size":346,"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":"pahaz:master","ref":"master","sha":"ec2f681ecaa22fa8050f981233971e9dd2930699","user":{"login":"pahaz","id":1394025,"avatar_url":"https://avatars.githubusercontent.com/u/1394025?v=3","gravatar_id":"","url":"https://api.github.com/users/pahaz","html_url":"https://github.com/pahaz","followers_url":"https://api.github.com/users/pahaz/followers","following_url":"https://api.github.com/users/pahaz/following{/other_user}","gists_url":"https://api.github.com/users/pahaz/gists{/gist_id}","starred_url":"https://api.github.com/users/pahaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pahaz/subscriptions","organizations_url":"https://api.github.com/users/pahaz/orgs","repos_url":"https://api.github.com/users/pahaz/repos","events_url":"https://api.github.com/users/pahaz/events{/privacy}","received_events_url":"https://api.github.com/users/pahaz/received_events","type":"User","site_admin":false},"repo":{"id":32398444,"name":"test1","full_name":"pahaz/test1","owner":{"login":"pahaz","id":1394025,"avatar_url":"https://avatars.githubusercontent.com/u/1394025?v=3","gravatar_id":"","url":"https://api.github.com/users/pahaz","html_url":"https://github.com/pahaz","followers_url":"https://api.github.com/users/pahaz/followers","following_url":"https://api.github.com/users/pahaz/following{/other_user}","gists_url":"https://api.github.com/users/pahaz/gists{/gist_id}","starred_url":"https://api.github.com/users/pahaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pahaz/subscriptions","organizations_url":"https://api.github.com/users/pahaz/orgs","repos_url":"https://api.github.com/users/pahaz/repos","events_url":"https://api.github.com/users/pahaz/events{/privacy}","received_events_url":"https://api.github.com/users/pahaz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pahaz/test1","description":"MVC EXAMPLE","fork":false,"url":"https://api.github.com/repos/pahaz/test1","forks_url":"https://api.github.com/repos/pahaz/test1/forks","keys_url":"https://api.github.com/repos/pahaz/test1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pahaz/test1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pahaz/test1/teams","hooks_url":"https://api.github.com/repos/pahaz/test1/hooks","issue_events_url":"https://api.github.com/repos/pahaz/test1/issues/events{/number}","events_url":"https://api.github.com/repos/pahaz/test1/events","assignees_url":"https://api.github.com/repos/pahaz/test1/assignees{/user}","branches_url":"https://api.github.com/repos/pahaz/test1/branches{/branch}","tags_url":"https://api.github.com/repos/pahaz/test1/tags","blobs_url":"https://api.github.com/repos/pahaz/test1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pahaz/test1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pahaz/test1/git/refs{/sha}","trees_url":"https://api.github.com/repos/pahaz/test1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pahaz/test1/statuses/{sha}","languages_url":"https://api.github.com/repos/pahaz/test1/languages","stargazers_url":"https://api.github.com/repos/pahaz/test1/stargazers","contributors_url":"https://api.github.com/repos/pahaz/test1/contributors","subscribers_url":"https://api.github.com/repos/pahaz/test1/subscribers","subscription_url":"https://api.github.com/repos/pahaz/test1/subscription","commits_url":"https://api.github.com/repos/pahaz/test1/commits{/sha}","git_commits_url":"https://api.github.com/repos/pahaz/test1/git/commits{/sha}","comments_url":"https://api.github.com/repos/pahaz/test1/comments{/number}","issue_comment_url":"https://api.github.com/repos/pahaz/test1/issues/comments{/number}","contents_url":"https://api.github.com/repos/pahaz/test1/contents/{+path}","compare_url":"https://api.github.com/repos/pahaz/test1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pahaz/test1/merges","archive_url":"https://api.github.com/repos/pahaz/test1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pahaz/test1/downloads","issues_url":"https://api.github.com/repos/pahaz/test1/issues{/number}","pulls_url":"https://api.github.com/repos/pahaz/test1/pulls{/number}","milestones_url":"https://api.github.com/repos/pahaz/test1/milestones{/number}","notifications_url":"https://api.github.com/repos/pahaz/test1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pahaz/test1/labels{/name}","releases_url":"https://api.github.com/repos/pahaz/test1/releases{/id}","created_at":"2015-03-17T14:31:09Z","updated_at":"2015-03-31T14:52:05Z","pushed_at":"2015-04-12T09:13:23Z","git_url":"git://github.com/pahaz/test1.git","ssh_url":"git@github.com:pahaz/test1.git","clone_url":"https://github.com/pahaz/test1.git","svn_url":"https://github.com/pahaz/test1","homepage":"","size":307,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":10,"forks":16,"open_issues":10,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pahaz/test1/pulls/11"},"html":{"href":"https://github.com/pahaz/test1/pull/11"},"issue":{"href":"https://api.github.com/repos/pahaz/test1/issues/11"},"comments":{"href":"https://api.github.com/repos/pahaz/test1/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/pahaz/test1/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/pahaz/test1/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pahaz/test1/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/pahaz/test1/statuses/68b7ba18141786c813eea280da1f7d89a4d040e6"}}}}