Fix readOnly pad export

The export request hook wasn't testing if the pad's id was from a read-only
pad before validating with the pad manager.

This includes an extra step that makes the read-only id verification and also
avoids setting the original pad's id as the file's name.
This commit is contained in:
Pedro Beschorner Marin 2020-09-16 14:57:27 -03:00 committed by John McLear
parent 9f63d9b76a
commit c56973ce74
3 changed files with 27 additions and 7 deletions

View file

@ -22,6 +22,16 @@
var db = require("./DB");
var randomString = require("../utils/randomstring");
/**
* checks if the id pattern matches a read-only pad id
* @param {String} the pad's id
*/
exports.isReadOnlyId = function(id)
{
return id.indexOf("r.") === 0;
}
/**
* returns a read only id for a pad
* @param {String} padId the id of the pad