diff --git a/src/public/javascripts/services/tree.js b/src/public/javascripts/services/tree.js index a8aa0ce71..ebb7f9922 100644 --- a/src/public/javascripts/services/tree.js +++ b/src/public/javascripts/services/tree.js @@ -331,7 +331,7 @@ function addRecentNote(branchId, notePath) { setTimeout(async () => { // we include the note into recent list only if the user stayed on the note at least 5 seconds if (notePath && notePath === getCurrentNotePath()) { - await server.put('recent-notes/' + branchId + '/' + encodeURIComponent(notePath)); + await server.post('recent-notes', { branchId, notePath }); } }, 1500); } diff --git a/src/routes/api/recent_notes.js b/src/routes/api/recent_notes.js index f4caca12f..0e3037f08 100644 --- a/src/routes/api/recent_notes.js +++ b/src/routes/api/recent_notes.js @@ -4,8 +4,8 @@ const optionService = require('../../services/options'); const RecentNote = require('../../entities/recent_note'); async function addRecentNote(req) { - const branchId = req.params.branchId; - const notePath = req.params.notePath; + const branchId = req.body.branchId; + const notePath = req.body.notePath; await new RecentNote({ branchId: branchId, diff --git a/src/routes/routes.js b/src/routes/routes.js index bd0ce6986..9cdcf586b 100644 --- a/src/routes/routes.js +++ b/src/routes/routes.js @@ -172,9 +172,7 @@ function register(app) { apiRoute(GET, '/api/event-log', eventLogRoute.getEventLog); - // * at the end means this will match params containing slash as well - // this is a problem with nginx (and possibly other proxies) which translate escaped slash back to the literal slash character - apiRoute(PUT, '/api/recent-notes/:branchId/:notePath*', recentNotesRoute.addRecentNote); + apiRoute(POST, '/api/recent-notes', recentNotesRoute.addRecentNote); apiRoute(GET, '/api/app-info', appInfoRoute.getAppInfo); route(GET, '/api/setup/status', [], setupApiRoute.getStatus, apiResultHandler);