{"action":"created","comment":{"url":"https://api.github.com/repos/RackHD/on-http/pulls/comments/60180414","id":60180414,"diff_hunk":"@@ -71,6 +71,59 @@ function filesRouterFactory (\n     });\n \n     /**\n+     * @api {get} /api/1.1/files/:filename/latest GET /:filename\n+     * @apiVersion 1.1.0\n+     * @apiDescription get the most recent version of a file by filename\n+     * @apiName files-get\n+     * @apiGroup files\n+     * @apiError NotFound The file with the <code>uuid</code> was not found.\n+     * @apiErrorExample Error-Response:\n+     *     HTTP/1.1 404 Not Found\n+     *     {\n+     *       \"error\": \"File not found.\"\n+     *     }\n+     */\n+\n+    router.get('/files/:filename/latest', function(req, res) {\n+        logger.debug(\"Received request for file by uuid\", {\n+            uuid: req.params.uuid\n+        });\n+\n+        var query = req.params.filename;\n+\n+        return fileService.verify(query)\n+        .then(function(metadata) {\n+            return metadata[0].uuid;\n+        })\n+        .then(function(uuid) {\n+            return fileService.get(uuid);\n+        })\n+        .then(function(rdStream) {\n+            rdStream.on('error', function(err){\n+                logger.error(\"Failure serving file request\", { error: err });\n+                res.status(500).json({\n+                    error: \"Failed to serve file request.\"\n+                });\n+            });\n+            rdStream.pipe(res);\n+        })\n+        .catch(function(err) {\n+            logger.error(\"Failure serving file request\", { error: err });\n+            if (err.name === '404') {\n+                res.status(404).json({\n+                    error: 'File not found.'\n+                });\n+            } else {\n+                res.status(500).json({\n+                    error: \"Failed to serve file request.\"\n+","path":"lib/api/1.1/southbound/files.js","position":49,"original_position":49,"commit_id":"05ef9f2bb9baa079ad9800549b3b25460481abb4","original_commit_id":"05ef9f2bb9baa079ad9800549b3b25460481abb4","user":{"login":"yyscamper","id":511378,"avatar_url":"https://avatars.githubusercontent.com/u/511378?v=3","gravatar_id":"","url":"https://api.github.com/users/yyscamper","html_url":"https://github.com/yyscamper","followers_url":"https://api.github.com/users/yyscamper/followers","following_url":"https://api.github.com/users/yyscamper/following{/other_user}","gists_url":"https://api.github.com/users/yyscamper/gists{/gist_id}","starred_url":"https://api.github.com/users/yyscamper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yyscamper/subscriptions","organizations_url":"https://api.github.com/users/yyscamper/orgs","repos_url":"https://api.github.com/users/yyscamper/repos","events_url":"https://api.github.com/users/yyscamper/events{/privacy}","received_events_url":"https://api.github.com/users/yyscamper/received_events","type":"User","site_admin":false},"body":"this empty line is not necessary.","created_at":"2016-04-19T06:51:11Z","updated_at":"2016-04-19T06:51:11Z","html_url":"https://github.com/RackHD/on-http/pull/230#discussion_r60180414","pull_request_url":"https://api.github.com/repos/RackHD/on-http/pulls/230","_links":{"self":{"href":"https://api.github.com/repos/RackHD/on-http/pulls/comments/60180414"},"html":{"href":"https://github.com/RackHD/on-http/pull/230#discussion_r60180414"},"pull_request":{"href":"https://api.github.com/repos/RackHD/on-http/pulls/230"}}},"pull_request":{"url":"https://api.github.com/repos/RackHD/on-http/pulls/230","id":66613015,"html_url":"https://github.com/RackHD/on-http/pull/230","diff_url":"https://github.com/RackHD/on-http/pull/230.diff","patch_url":"https://github.com/RackHD/on-http/pull/230.patch","issue_url":"https://api.github.com/repos/RackHD/on-http/issues/230","number":230,"state":"open","locked":false,"title":"Add file latest and file md5 latest to south API router","user":{"login":"WangWinson","id":14069485,"avatar_url":"https://avatars.githubusercontent.com/u/14069485?v=3","gravatar_id":"","url":"https://api.github.com/users/WangWinson","html_url":"https://github.com/WangWinson","followers_url":"https://api.github.com/users/WangWinson/followers","following_url":"https://api.github.com/users/WangWinson/following{/other_user}","gists_url":"https://api.github.com/users/WangWinson/gists{/gist_id}","starred_url":"https://api.github.com/users/WangWinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WangWinson/subscriptions","organizations_url":"https://api.github.com/users/WangWinson/orgs","repos_url":"https://api.github.com/users/WangWinson/repos","events_url":"https://api.github.com/users/WangWinson/events{/privacy}","received_events_url":"https://api.github.com/users/WangWinson/received_events","type":"User","site_admin":false},"body":"To solve issue https://github.com/RackHD/on-http/issues/215\r\n\r\n@RackHD/corecommitters @cgx027 \r\n","created_at":"2016-04-15T09:20:48Z","updated_at":"2016-04-19T06:51:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0b0bb4d08b2e9396a907e7b6ac223adcc04797d0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/RackHD/on-http/pulls/230/commits","review_comments_url":"https://api.github.com/repos/RackHD/on-http/pulls/230/comments","review_comment_url":"https://api.github.com/repos/RackHD/on-http/pulls/comments{/number}","comments_url":"https://api.github.com/repos/RackHD/on-http/issues/230/comments","statuses_url":"https://api.github.com/repos/RackHD/on-http/statuses/05ef9f2bb9baa079ad9800549b3b25460481abb4","head":{"label":"WangWinson:bugfix/issue_215","ref":"bugfix/issue_215","sha":"05ef9f2bb9baa079ad9800549b3b25460481abb4","user":{"login":"WangWinson","id":14069485,"avatar_url":"https://avatars.githubusercontent.com/u/14069485?v=3","gravatar_id":"","url":"https://api.github.com/users/WangWinson","html_url":"https://github.com/WangWinson","followers_url":"https://api.github.com/users/WangWinson/followers","following_url":"https://api.github.com/users/WangWinson/following{/other_user}","gists_url":"https://api.github.com/users/WangWinson/gists{/gist_id}","starred_url":"https://api.github.com/users/WangWinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WangWinson/subscriptions","organizations_url":"https://api.github.com/users/WangWinson/orgs","repos_url":"https://api.github.com/users/WangWinson/repos","events_url":"https://api.github.com/users/WangWinson/events{/privacy}","received_events_url":"https://api.github.com/users/WangWinson/received_events","type":"User","site_admin":false},"repo":{"id":50007067,"name":"on-http","full_name":"WangWinson/on-http","owner":{"login":"WangWinson","id":14069485,"avatar_url":"https://avatars.githubusercontent.com/u/14069485?v=3","gravatar_id":"","url":"https://api.github.com/users/WangWinson","html_url":"https://github.com/WangWinson","followers_url":"https://api.github.com/users/WangWinson/followers","following_url":"https://api.github.com/users/WangWinson/following{/other_user}","gists_url":"https://api.github.com/users/WangWinson/gists{/gist_id}","starred_url":"https://api.github.com/users/WangWinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WangWinson/subscriptions","organizations_url":"https://api.github.com/users/WangWinson/orgs","repos_url":"https://api.github.com/users/WangWinson/repos","events_url":"https://api.github.com/users/WangWinson/events{/privacy}","received_events_url":"https://api.github.com/users/WangWinson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/WangWinson/on-http","description":"","fork":true,"url":"https://api.github.com/repos/WangWinson/on-http","forks_url":"https://api.github.com/repos/WangWinson/on-http/forks","keys_url":"https://api.github.com/repos/WangWinson/on-http/keys{/key_id}","collaborators_url":"https://api.github.com/repos/WangWinson/on-http/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/WangWinson/on-http/teams","hooks_url":"https://api.github.com/repos/WangWinson/on-http/hooks","issue_events_url":"https://api.github.com/repos/WangWinson/on-http/issues/events{/number}","events_url":"https://api.github.com/repos/WangWinson/on-http/events","assignees_url":"https://api.github.com/repos/WangWinson/on-http/assignees{/user}","branches_url":"https://api.github.com/repos/WangWinson/on-http/branches{/branch}","tags_url":"https://api.github.com/repos/WangWinson/on-http/tags","blobs_url":"https://api.github.com/repos/WangWinson/on-http/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/WangWinson/on-http/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/WangWinson/on-http/git/refs{/sha}","trees_url":"https://api.github.com/repos/WangWinson/on-http/git/trees{/sha}","statuses_url":"https://api.github.com/repos/WangWinson/on-http/statuses/{sha}","languages_url":"https://api.github.com/repos/WangWinson/on-http/languages","stargazers_url":"https://api.github.com/repos/WangWinson/on-http/stargazers","contributors_url":"https://api.github.com/repos/WangWinson/on-http/contributors","subscribers_url":"https://api.github.com/repos/WangWinson/on-http/subscribers","subscription_url":"https://api.github.com/repos/WangWinson/on-http/subscription","commits_url":"https://api.github.com/repos/WangWinson/on-http/commits{/sha}","git_commits_url":"https://api.github.com/repos/WangWinson/on-http/git/commits{/sha}","comments_url":"https://api.github.com/repos/WangWinson/on-http/comments{/number}","issue_comment_url":"https://api.github.com/repos/WangWinson/on-http/issues/comments{/number}","contents_url":"https://api.github.com/repos/WangWinson/on-http/contents/{+path}","compare_url":"https://api.github.com/repos/WangWinson/on-http/compare/{base}...{head}","merges_url":"https://api.github.com/repos/WangWinson/on-http/merges","archive_url":"https://api.github.com/repos/WangWinson/on-http/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/WangWinson/on-http/downloads","issues_url":"https://api.github.com/repos/WangWinson/on-http/issues{/number}","pulls_url":"https://api.github.com/repos/WangWinson/on-http/pulls{/number}","milestones_url":"https://api.github.com/repos/WangWinson/on-http/milestones{/number}","notifications_url":"https://api.github.com/repos/WangWinson/on-http/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/WangWinson/on-http/labels{/name}","releases_url":"https://api.github.com/repos/WangWinson/on-http/releases{/id}","deployments_url":"https://api.github.com/repos/WangWinson/on-http/deployments","created_at":"2016-01-20T05:31:46Z","updated_at":"2016-01-20T05:31:47Z","pushed_at":"2016-04-15T09:17:23Z","git_url":"git://github.com/WangWinson/on-http.git","ssh_url":"git@github.com:WangWinson/on-http.git","clone_url":"https://github.com/WangWinson/on-http.git","svn_url":"https://github.com/WangWinson/on-http","homepage":null,"size":2372,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"RackHD:master","ref":"master","sha":"205038285c76a6e144c3b3d618fc1f648f7896af","user":{"login":"RackHD","id":13982662,"avatar_url":"https://avatars.githubusercontent.com/u/13982662?v=3","gravatar_id":"","url":"https://api.github.com/users/RackHD","html_url":"https://github.com/RackHD","followers_url":"https://api.github.com/users/RackHD/followers","following_url":"https://api.github.com/users/RackHD/following{/other_user}","gists_url":"https://api.github.com/users/RackHD/gists{/gist_id}","starred_url":"https://api.github.com/users/RackHD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RackHD/subscriptions","organizations_url":"https://api.github.com/users/RackHD/orgs","repos_url":"https://api.github.com/users/RackHD/repos","events_url":"https://api.github.com/users/RackHD/events{/privacy}","received_events_url":"https://api.github.com/users/RackHD/received_events","type":"Organization","site_admin":false},"repo":{"id":41690081,"name":"on-http","full_name":"RackHD/on-http","owner":{"login":"RackHD","id":13982662,"avatar_url":"https://avatars.githubusercontent.com/u/13982662?v=3","gravatar_id":"","url":"https://api.github.com/users/RackHD","html_url":"https://github.com/RackHD","followers_url":"https://api.github.com/users/RackHD/followers","following_url":"https://api.github.com/users/RackHD/following{/other_user}","gists_url":"https://api.github.com/users/RackHD/gists{/gist_id}","starred_url":"https://api.github.com/users/RackHD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RackHD/subscriptions","organizations_url":"https://api.github.com/users/RackHD/orgs","repos_url":"https://api.github.com/users/RackHD/repos","events_url":"https://api.github.com/users/RackHD/events{/privacy}","received_events_url":"https://api.github.com/users/RackHD/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/RackHD/on-http","description":"","fork":false,"url":"https://api.github.com/repos/RackHD/on-http","forks_url":"https://api.github.com/repos/RackHD/on-http/forks","keys_url":"https://api.github.com/repos/RackHD/on-http/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RackHD/on-http/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RackHD/on-http/teams","hooks_url":"https://api.github.com/repos/RackHD/on-http/hooks","issue_events_url":"https://api.github.com/repos/RackHD/on-http/issues/events{/number}","events_url":"https://api.github.com/repos/RackHD/on-http/events","assignees_url":"https://api.github.com/repos/RackHD/on-http/assignees{/user}","branches_url":"https://api.github.com/repos/RackHD/on-http/branches{/branch}","tags_url":"https://api.github.com/repos/RackHD/on-http/tags","blobs_url":"https://api.github.com/repos/RackHD/on-http/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RackHD/on-http/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RackHD/on-http/git/refs{/sha}","trees_url":"https://api.github.com/repos/RackHD/on-http/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RackHD/on-http/statuses/{sha}","languages_url":"https://api.github.com/repos/RackHD/on-http/languages","stargazers_url":"https://api.github.com/repos/RackHD/on-http/stargazers","contributors_url":"https://api.github.com/repos/RackHD/on-http/contributors","subscribers_url":"https://api.github.com/repos/RackHD/on-http/subscribers","subscription_url":"https://api.github.com/repos/RackHD/on-http/subscription","commits_url":"https://api.github.com/repos/RackHD/on-http/commits{/sha}","git_commits_url":"https://api.github.com/repos/RackHD/on-http/git/commits{/sha}","comments_url":"https://api.github.com/repos/RackHD/on-http/comments{/number}","issue_comment_url":"https://api.github.com/repos/RackHD/on-http/issues/comments{/number}","contents_url":"https://api.github.com/repos/RackHD/on-http/contents/{+path}","compare_url":"https://api.github.com/repos/RackHD/on-http/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RackHD/on-http/merges","archive_url":"https://api.github.com/repos/RackHD/on-http/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RackHD/on-http/downloads","issues_url":"https://api.github.com/repos/RackHD/on-http/issues{/number}","pulls_url":"https://api.github.com/repos/RackHD/on-http/pulls{/number}","milestones_url":"https://api.github.com/repos/RackHD/on-http/milestones{/number}","notifications_url":"https://api.github.com/repos/RackHD/on-http/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RackHD/on-http/labels{/name}","releases_url":"https://api.github.com/repos/RackHD/on-http/releases{/id}","deployments_url":"https://api.github.com/repos/RackHD/on-http/deployments","created_at":"2015-08-31T17:29:08Z","updated_at":"2016-04-13T20:03:51Z","pushed_at":"2016-04-19T05:42:51Z","git_url":"git://github.com/RackHD/on-http.git","ssh_url":"git@github.com:RackHD/on-http.git","clone_url":"https://github.com/RackHD/on-http.git","svn_url":"https://github.com/RackHD/on-http","homepage":null,"size":2796,"stargazers_count":10,"watchers_count":10,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":41,"mirror_url":null,"open_issues_count":12,"forks":41,"open_issues":12,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/RackHD/on-http/pulls/230"},"html":{"href":"https://github.com/RackHD/on-http/pull/230"},"issue":{"href":"https://api.github.com/repos/RackHD/on-http/issues/230"},"comments":{"href":"https://api.github.com/repos/RackHD/on-http/issues/230/comments"},"review_comments":{"href":"https://api.github.com/repos/RackHD/on-http/pulls/230/comments"},"review_comment":{"href":"https://api.github.com/repos/RackHD/on-http/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/RackHD/on-http/pulls/230/commits"},"statuses":{"href":"https://api.github.com/repos/RackHD/on-http/statuses/05ef9f2bb9baa079ad9800549b3b25460481abb4"}}}}