-
Notifications
You must be signed in to change notification settings - Fork 181
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
histserv delete returns spurrious success message if incorrect parameters #2020
Comments
I can't reproduce this. With the MySQL backend, I get:
With the in-memory backend, I get:
|
Fixes ergochat#2020 Calling /msg histserv delete #wrongchan <msgid> returns spurrious success message. Calling /msg histserv delete <randomchars> <msgid> returns similar message. These would lead to the pointer hist == nil, and server.historyDB.DeleteMsgid() would return nil. Returns errNoSuchChannel or errInvalidTarget if channel or client == nil
thanks for your reply. Tested some more and I found that using a correct channel name and incorrect msgid returned the I realized that using an incorrect channel name or other name for the target (which gets interpreted as a username) causes the issue however. Lines 1057 to 1073 in f6f7315
If client == nil and channel == nil, that would mean that the channel or username was not found. This is not caught by this function, and hist is left as a nil pointer, which leads to server.historyDB.DeleteMsgid being called, which returns nil if mysql.db is nil. Since err == nil as a result of this, this caused the success message to be displayed on my ephemeral storage network. Submitted #2024 which should fix this, by returning an error if the target is not a valid channel or username. We can discuss more over there, if you would consider this the intended behavior |
If hist == nil and mysql database Delete msgid function returns ErrDBIsNil, we know that the target does not match any channel or user. Return invalid target error to operator (see ergochat#2020)
Just checked that this works on v2.11.0-rc1
msg histserv delete
returns the success message no matter what the two parameters are (it does correctly throw an error if not enough or two many parameters are given).On latest ergo, the following should all return the same message
msg histserv delete #<channel> <wrong msgid>
msg histserv delete #<nonexistent channel> <some msgid>
msg histserv delete first second
The text was updated successfully, but these errors were encountered: