Skip to content

Commit

Permalink
Merge pull request #8239 from weseek/support/obsolete-route-for-attac…
Browse files Browse the repository at this point in the history
…hment

support: Remove obsolete route for attachment on MongoDB GridFS
  • Loading branch information
yuki-takei authored Nov 17, 2023
2 parents 801600a + 71935da commit c6cf154
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 23 deletions.
22 changes: 0 additions & 22 deletions apps/app/src/server/routes/attachment.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,28 +310,6 @@ module.exports = function(crowi, app) {
return responseForAttachment(req, res, brandLogoAttachment);
};

/**
* @api {get} /attachments.obsoletedGetForMongoDB get attachments from mongoDB
* @apiName get
* @apiGroup Attachment
*
* @apiParam {String} pageId, fileName
*/
api.obsoletedGetForMongoDB = async function(req, res) {
if (crowi.configManager.getConfig('crowi', 'app:fileUploadType') !== 'mongodb') {
return res.status(400);
}

const pageId = req.params.pageId;
const fileName = req.params.fileName;
const filePath = `attachment/${pageId}/${fileName}`;

const attachment = await Attachment.findOne({ filePath });

return responseForAttachment(req, res, attachment);
};


/**
* @swagger
*
Expand Down
1 change: 0 additions & 1 deletion apps/app/src/server/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ module.exports = function(crowi, app) {
app.get('/me/*' , loginRequiredStrictly, next.delegateToNext);
app.get('/attachment/:id([0-9a-z]{24})' , certifySharedPageAttachmentMiddleware , loginRequired, attachment.api.get);
app.get('/attachment/profile/:id([0-9a-z]{24})' , loginRequired, attachment.api.get);
app.get('/attachment/:pageId/:fileName' , loginRequired, attachment.api.obsoletedGetForMongoDB); // DEPRECATED: remains for backward compatibility for v3.3.x or below
app.get('/download/:id([0-9a-z]{24})' , certifySharedPageAttachmentMiddleware, loginRequired, attachment.api.download);

app.get('/_search' , loginRequired, next.delegateToNext);
Expand Down

0 comments on commit c6cf154

Please sign in to comment.