Skip to content

fix(ui): /url: Print usage error on bad number of arguments consistently - #2224

Closed
shan995-cell wants to merge 1 commit into
profanity-im:masterfrom
shan995-cell:url-usage-error
Closed

shan995-cell wants to merge 1 commit into
profanity-im:masterfrom
shan995-cell:url-usage-error

Conversation

@shan995-cell

Copy link
Copy Markdown

PR on behalf of "onf".

/url save and /url open checked if they are called in the right window
before checking that the number of arguments passed is correct, making
the resulting error message focused on the less important problem in
invocation.

Signed-off-by: onf <onf@disroot.org>
@shan995-cell

Copy link
Copy Markdown
Author

Updated to v2 -- adds the missing Signed-off-by.

Comment thread src/command/cmd_funcs.c
{
if (window->type != WIN_CHAT && window->type != WIN_MUC && window->type != WIN_PRIVATE) {
cons_show_error("`/url save` is not supported in this window.");
if (args[1] == NULL) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

min_args = 2 in _cmd_execute. So this is already caught.

@jubalh jubalh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something is wrong here, you need to check src/command/cmd_defs.c.
Grep for cmd_url. The CMD_PREAMBLE part is relevant.
In cmd_url_open the if (url == NULL) needs to be adjusted And in cmd_url_save the arg check as well.

@shan995-cell

Copy link
Copy Markdown
Author

Closing; onf says this was his fault. Min args was reduced to 1 by his own changes in the /url own PR, and he has folded the fix into #2214 (v5, will be pushing in a while).

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

Successfully merging this pull request may close these issues.

2 participants