Prevent image upscaling
This commit is contained in:
parent
39d3d568e8
commit
94aabcd07e
@ -140,12 +140,17 @@ async function uploadImage (identifier, fields, files) {
|
||||
return bailOut(file, 'Avatars can only have an aspect ratio of 1:1')
|
||||
}
|
||||
|
||||
if (fields.scaleX) {
|
||||
// Upscaling is not allowed
|
||||
if ((fields.scaleX != null && fields.scaleX > 1) || (fields.scaleY != null && fields.scaleY > 1)) {
|
||||
return bailOut(file, 'Image upscaling is not allowed.')
|
||||
}
|
||||
|
||||
if (fields.scaleX != null) {
|
||||
fields.x *= fields.scaleX
|
||||
fields.width *= fields.scaleX
|
||||
}
|
||||
|
||||
if (fields.scaleY) {
|
||||
if (fields.scaleY != null) {
|
||||
fields.y *= fields.scaleY
|
||||
fields.height *= fields.scaleY
|
||||
}
|
||||
|
Reference in New Issue
Block a user