Eval output allows too many lines #2492
Labels
a: frontend
Related to output and formatting
a: utility
Related to utility commands: (bot, eval, extensions, jams, reminders, snekbox, utils)
p: 2 - normal
Normal Priority
status: approved
The issue has received a core developer's approval
t: bug
Something isn't working
The Problem
The
MAX_OUTPUT_BLOCK_LINES
variable is set to a value of 10, which means under the current logic evals which output more than 10 lines, will be uploaded to the haste site (paste.pydis.com) and a message will be added to the eval output stating it was truncated.However, since we currently update the lines variable to be
lines[:max_lines+1]
, outputs of 11 lines (such asfor x in range(11): print(x)
) will be uploaded to the pastebin and still display all 11 lines (despite the limit being 10). This also means that the paste content is the same as what's sent to Discord as the eval content.The code should be changed to instead change lines to
lines[:max_lines]
. This will also break the logic underneath (you've shortened so will never be more thanmax_lines
) so the if statements will have to be swapped around.Current Code
Proposed Solution (approx.)
Notice that the proposed solution sets lines to
lines[:max_lines]
instead oflines[:max_lines + 1]
. In reality theif truncated
part can just be slotted into the pre-existingif truncated
blockThe text was updated successfully, but these errors were encountered: