Skip to content

PEP Command Fails on Empty Metadata #720

@sco1

Description

@sco1

Currently, the PEP command assumes that if a metadata field is present in the PEP's summary table that the value is populated:

bot/bot/cogs/utils.py

Lines 64 to 72 in 74d9905

# Add the interesting information
if "Status" in pep_header:
pep_embed.add_field(name="Status", value=pep_header["Status"])
if "Python-Version" in pep_header:
pep_embed.add_field(name="Python-Version", value=pep_header["Python-Version"])
if "Created" in pep_header:
pep_embed.add_field(name="Created", value=pep_header["Created"])
if "Type" in pep_header:
pep_embed.add_field(name="Type", value=pep_header["Type"])

However, this is not always the case, e.g. PEP 249:

image

Because of this, the embed field's value can be provided an empty string, causing an exception to be raised:

HTTPException: 400 BAD REQUEST (error code: 50035): Invalid Form Body
In embed.fields.1.value: This field is required

To fix this, there should be a catch for empty values to prevent a field being added if there's no value to populate.

Metadata

Metadata

Assignees

Labels

a: informationRelated to information commands: (doc, help, information, reddit, site, tags)p: 3 - lowLow Prioritys: WIPWork In Progresst: bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions