[18.0][FIX] base_remote: skip ensure_one on empty remotes during RPC auth#3611
Open
fsmw wants to merge 1 commit into
Open
[18.0][FIX] base_remote: skip ensure_one on empty remotes during RPC auth#3611fsmw wants to merge 1 commit into
fsmw wants to merge 1 commit into
Conversation
XML-RPC and JSON-RPC calls have no HTTP context, so remote property returns an empty recordset. Calling ensure_one() on it crashes with 'Expected singleton: res.remote()'. Fix: add a truthiness guard, only enforce ensure_one when the remote recordset is not empty, matching how the code already handles test mode. Fixes OCA#3458
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3458
When authenticating via XML-RPC or JSON-RPC (no HTTP context), the
remote property returns an empty recordset. Calling ensure_one() on
it crashes with ValueError: Expected singleton: res.remote().
Web browser logins continue to work because httprequest.remote_addr
is always present and returns a single record.
Fix: add a truthiness guard so we only call ensure_one() when a
remote record exists, matching the same pattern already used for
test mode.
This is exactly the fix proposed in the issue report.