discord-api-docs icon indicating copy to clipboard operation
discord-api-docs copied to clipboard

String options can have min_length be set to more than max_length

Open onerandomusername opened this issue 3 years ago • 2 comments

Description

String options can have min_length be set to more than max_length, making the option impossible to provide, and possibly the entire command if this argument is required.

Steps to Reproduce

register a slash command with an option that has max_length set to less than the min_length. A payload has been provided below.

{
 "type": 1,
 "name": "str_length_go_brr",
 "dm_permission": true,
 "default_permission": true,
 "default_member_permissions": null,
 "description": "-",
 "options": [
  {
   "name": "option",
   "description": "-",
   "type": 3,
   "required": true,
   "min_length": 3000,
   "max_length": 1
  }
 ]
}

Expected Behavior

registration error

Current Behavior

command gets registered with an option that can never be provided.

Screenshots/Videos

image

Client and System Information

disnake 2.6.0a

onerandomusername avatar Jul 02 '22 19:07 onerandomusername

Suggested fix: In such cases, quietly swap minimum and maximum length and treat the request as successful if there are no other errors.

erkinalp avatar Jul 24 '22 09:07 erkinalp

Suggested fix: In such cases, quietly swap minimum and maximum length and treat the request as successful if there are no other errors.

Secretly change user input instead of properly 400ing telling them the input is in fact, incorrect?

ooliver1 avatar Jul 24 '22 18:07 ooliver1

A fix should be out soonish.

devsnek avatar Sep 19 '22 21:09 devsnek