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

[Proposal] Filtering when an empty command is passed #1393

Open
woung717 opened this issue Dec 12, 2024 · 1 comment
Open

[Proposal] Filtering when an empty command is passed #1393

woung717 opened this issue Dec 12, 2024 · 1 comment

Comments

@woung717
Copy link
Contributor

woung717 commented Dec 12, 2024

In the current implementation, an exception prevention for empty string("") commands is required.
If an empty string is passed, the shlex function returns an empty list, causing an unpacking error when trying to unpack into one or more return variables. (at L63)

async def handle_request(self, pr_url, request, notify=None) -> bool:
# First, apply repo specific settings if exists
apply_repo_settings(pr_url)
# Then, apply user specific settings if exists
if isinstance(request, str):
request = request.replace("'", "\\'")
lexer = shlex.shlex(request, posix=True)
lexer.whitespace_split = True
action, *args = list(lexer)
else:
action, *args = request

This can happen if an empty string is set in .pr_agent.toml like this

pr_commands = [ "" ]

Thank you for developing this amazing project.

@woung717 woung717 changed the title [Proposal] Filtering when empty command is passed [Proposal] Filtering when an empty command is passed Dec 12, 2024
@mrT23
Copy link
Collaborator

mrT23 commented Dec 24, 2024

i am not sure i understand this issue.
if you set:
pr_commands = [ "" ]

Why would you get to handle_request ? There would be no commands to run:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants