mirror of
https://github.com/azures04/crafatar.git
synced 2026-05-06 11:00:39 +02:00
strip dashes from uuids before handling them
This commit is contained in:
@@ -67,6 +67,9 @@ module.exports = function(req, callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
// strip dashes
|
||||
userId = userId.replace(/-/g, "");
|
||||
|
||||
// Prevent app from crashing/freezing
|
||||
if (size < config.avatars.min_size || size > config.avatars.max_size) {
|
||||
// "Unprocessable Entity", valid request, but semantically erroneous:
|
||||
@@ -84,9 +87,6 @@ module.exports = function(req, callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
// strip dashes
|
||||
userId = userId.replace(/-/g, "");
|
||||
|
||||
try {
|
||||
helpers.get_avatar(req.id, userId, overlay, size, function(err, status, image, hash) {
|
||||
if (err) {
|
||||
|
||||
@@ -17,6 +17,8 @@ module.exports = function(req, callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
// strip dashes
|
||||
userId = userId.replace(/-/g, "");
|
||||
if (!helpers.id_valid(userId)) {
|
||||
callback({
|
||||
status: -2,
|
||||
@@ -25,9 +27,6 @@ module.exports = function(req, callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
// strip dashes
|
||||
userId = userId.replace(/-/g, "");
|
||||
|
||||
try {
|
||||
helpers.get_cape(rid, userId, function(err, hash, status, image) {
|
||||
if (err) {
|
||||
|
||||
@@ -85,6 +85,9 @@ module.exports = function(req, callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
// strip dashes
|
||||
userId = userId.replace(/-/g, "");
|
||||
|
||||
if (scale < config.renders.min_scale || scale > config.renders.max_scale) {
|
||||
callback({
|
||||
status: -2,
|
||||
@@ -99,9 +102,6 @@ module.exports = function(req, callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
// strip dashes
|
||||
userId = userId.replace(/-/g, "");
|
||||
|
||||
try {
|
||||
helpers.get_render(rid, userId, scale, overlay, body, function(err, status, hash, image) {
|
||||
if (err) {
|
||||
|
||||
@@ -75,6 +75,8 @@ module.exports = function(req, callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
// strip dashes
|
||||
userId = userId.replace(/-/g, "");
|
||||
if (!helpers.id_valid(userId)) {
|
||||
callback({
|
||||
status: -2,
|
||||
@@ -83,9 +85,6 @@ module.exports = function(req, callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
// strip dashes
|
||||
userId = userId.replace(/-/g, "");
|
||||
|
||||
try {
|
||||
helpers.get_skin(rid, userId, function(err, hash, status, image, slim) {
|
||||
if (err) {
|
||||
|
||||
Reference in New Issue
Block a user