|
|
@@ -11,7 +11,7 @@ module.exports = function(crowi, app) {
|
|
|
|
|
|
function getPathFromRequest(req) {
|
|
|
var path = '/' + (req.params[0] || '');
|
|
|
- return path;
|
|
|
+ return path.replace(/\.md$/, '');
|
|
|
}
|
|
|
|
|
|
function isUserPage(path) {
|
|
|
@@ -176,13 +176,16 @@ module.exports = function(crowi, app) {
|
|
|
return ;
|
|
|
}
|
|
|
|
|
|
- // single page
|
|
|
- var parentPath = path.split('/').slice(0, -1).join('/'); // TODO : limitation
|
|
|
-
|
|
|
Page.findPage(path, req.user, req.query.revision)
|
|
|
.then(function(page) {
|
|
|
debug('Page found', page._id, page.path);
|
|
|
|
|
|
+ // FIXME: せっかく getPathFromRequest になってるのにここが生 params[0] だとダサイ
|
|
|
+ if (req.params[0].match(/.+\.md$/)) {
|
|
|
+ res.set('Content-Type', 'text/plain');
|
|
|
+ return res.send(page.revision.body);
|
|
|
+ }
|
|
|
+
|
|
|
return renderPage(page, req, res);
|
|
|
}).catch(function(err) {
|
|
|
if (req.query.revision) {
|