Skip to content

patch(/code *): add better option validation for line / entity queries #51

Description

@sudojunior

Currently, it is theoretically possible to attempt selecting a range below 0.

  • /code entity
    • around should be greater than 0
  • /code lines
    • start and end should be greater than 1

This is currently the only check in place, checking if startLine exceeds the total line count of the file.

if (startLine > lines.length) {
return {
ephemeral: true,
content: [
`**Failover:** Line selection out of bounds.`,
`> Start Line: \`${startLine + 1}\``,
`> Total Lines: \`${lines.length}\``
].join('\n')
};
}

#50 could easily be thrown out and have an error returned instead, for which an onError method could be added.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions