Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks
sudojunior opened this issue Aug 11, 2023 · 0 comments
Open
2 tasks
Labels
bug Something isn't working enhancement New feature or request

Comments

@sudojunior
Copy link
Member

sudojunior commented Aug 11, 2023

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.

@sudojunior sudojunior added bug Something isn't working enhancement New feature or request labels Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant