prevent large images

This commit is contained in:
jomo 2014-10-19 23:36:58 +02:00
parent fbbbdf02f6
commit 77bcf9dbe7
2 changed files with 3 additions and 5 deletions

View File

@ -9,10 +9,8 @@ var valid_uuid = /^[0-9a-f]{32}$/;
router.get('/:uuid/:size?', function(req, res) { router.get('/:uuid/:size?', function(req, res) {
var uuid = req.param('uuid'); var uuid = req.param('uuid');
var size = req.param('size') || 180; var size = req.param('size') || 180;
// Add temporary restriction to prevent app from crashing // Prevent app from crashing/freezing
if (size <= 0) { if (size <= 0 || size > 512) size = 180;
size = 180;
}
console.log(uuid); console.log(uuid);
if (valid_uuid.test(uuid)) { if (valid_uuid.test(uuid)) {
var filename = uuid + ".png"; var filename = uuid + ".png";

View File

@ -19,7 +19,7 @@ block content
| "&gt; | "&gt;
p(style="margin-top: 10px;") Example: UUID: '2d5aa9cdaeb049189930461fc9b91cc5', Username: Jake0oo0 p(style="margin-top: 10px;") Example: UUID: '2d5aa9cdaeb049189930461fc9b91cc5', Username: Jake0oo0
.well &lt;img src="https://skins.jake0oo0.me/avatars/2d5aa9cdaeb049189930461fc9b91cc5"&gt; .well &lt;img src="https://skins.jake0oo0.me/avatars/2d5aa9cdaeb049189930461fc9b91cc5"&gt;
p(style="margin-top: 10px;") There is also an option to include a size, default is 180x180px. p(style="margin-top: 10px;") There is also an option to include a size, default is 180x180px. The size may not be larger than 512px.
.well .well
| &lt;img src="https://skins.jake0oo0.me/avatars/ | &lt;img src="https://skins.jake0oo0.me/avatars/
mark.green uuid mark.green uuid