sync fix to prefix and some usability improvements

This commit is contained in:
azivner
2017-11-26 23:10:23 -05:00
parent 37a105db4d
commit 8b5988e13c
8 changed files with 40 additions and 24 deletions

View File

@@ -6,6 +6,7 @@ const auth = require('../../services/auth');
const sql = require('../../services/sql');
const utils = require('../../services/utils');
const notes = require('../../services/notes');
const log = require('../../services/log');
const protected_session = require('../../services/protected_session');
const data_encryption = require('../../services/data_encryption');
const RequestContext = require('../../services/request_context');
@@ -15,6 +16,12 @@ router.get('/:noteId', auth.checkApiAuth, async (req, res, next) => {
const detail = await sql.getSingleResult("SELECT * FROM notes WHERE note_id = ?", [noteId]);
if (!detail) {
log.info("Note " + noteId + " has not been found.");
return res.status(404).send({});
}
if (detail.is_protected) {
const dataKey = protected_session.getDataKey(req);