From 9d4d90447952a1d588546969199a4f9b5bef6ad2 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 27 Aug 2015 23:14:31 -0400 Subject: [PATCH] 404 fix --- public/src/ajaxify.js | 3 ++- src/routes/index.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index 057847351b..ee37ad0288 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -110,6 +110,7 @@ $(document).ready(function() { textStatus = err.textStatus; if (data) { + data.responseJSON.config = config; var status = parseInt(data.status, 10); if (status === 403 || status === 404 || status === 500 || status === 502) { if (status === 502) { @@ -117,7 +118,7 @@ $(document).ready(function() { } $('#footer, #content').removeClass('hide').addClass('ajaxifying'); - return renderTemplate(url, status.toString(), data.responseJSON, (new Date()).getTime(), callback); + return renderTemplate(url, status.toString(), data.responseJSON, callback); } else if (status === 401) { app.alertError('[[global:please_log_in]]'); app.previousUrl = url; diff --git a/src/routes/index.js b/src/routes/index.js index 67238e4dbe..a59b50a5e8 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -189,7 +189,7 @@ function handle404(app, middleware) { res.status(404); if (res.locals.isAPI) { - return res.json({path: req.path, title: '[[global:404.title]]'}); + return res.json({path: req.path.replace(/^\/api/, ''), title: '[[global:404.title]]'}); } middleware.buildHeader(req, res, function() {