Update response to force note, publish note, publish slide redirect to their expected url
This commit is contained in:
@@ -188,6 +188,11 @@ function findNote(req, res, callback, include) {
|
|||||||
|
|
||||||
function showNote(req, res, next) {
|
function showNote(req, res, next) {
|
||||||
findNote(req, res, function (note) {
|
findNote(req, res, function (note) {
|
||||||
|
// force to use note id
|
||||||
|
var noteId = req.params.noteId;
|
||||||
|
var id = LZString.compressToBase64(note.id);
|
||||||
|
if ((note.alias && noteId != note.alias) || (!note.alias && noteId != id))
|
||||||
|
return res.redirect(config.serverurl + "/" + (note.alias || id));
|
||||||
return responseHackMD(res, note);
|
return responseHackMD(res, note);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -201,6 +206,10 @@ function showPublishNote(req, res, next) {
|
|||||||
as: "lastchangeuser"
|
as: "lastchangeuser"
|
||||||
}];
|
}];
|
||||||
findNote(req, res, function (note) {
|
findNote(req, res, function (note) {
|
||||||
|
// force to use short id
|
||||||
|
var shortid = req.params.shortid;
|
||||||
|
if ((note.alias && shortid != note.alias) || (!note.alias && shortid != note.shortid))
|
||||||
|
return res.redirect(config.serverurl + "/s/" + (note.alias || note.shortid));
|
||||||
note.increment('viewcount').then(function (note) {
|
note.increment('viewcount').then(function (note) {
|
||||||
if (!note) {
|
if (!note) {
|
||||||
return response.errorNotFound(res);
|
return response.errorNotFound(res);
|
||||||
@@ -519,6 +528,10 @@ function gitlabActionProjects(req, res, note) {
|
|||||||
|
|
||||||
function showPublishSlide(req, res, next) {
|
function showPublishSlide(req, res, next) {
|
||||||
findNote(req, res, function (note) {
|
findNote(req, res, function (note) {
|
||||||
|
// force to use short id
|
||||||
|
var shortid = req.params.shortid;
|
||||||
|
if ((note.alias && shortid != note.alias) || (!note.alias && shortid != note.shortid))
|
||||||
|
return res.redirect(config.serverurl + "/p/" + (note.alias || note.shortid));
|
||||||
note.increment('viewcount').then(function (note) {
|
note.increment('viewcount').then(function (note) {
|
||||||
if (!note) {
|
if (!note) {
|
||||||
return response.errorNotFound(res);
|
return response.errorNotFound(res);
|
||||||
|
|||||||
Reference in New Issue
Block a user