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

Commenting with xid param throws bad_pid error #1848

Open
lpalazzi opened this issue Nov 25, 2024 · 0 comments
Open

Commenting with xid param throws bad_pid error #1848

lpalazzi opened this issue Nov 25, 2024 · 0 comments

Comments

@lpalazzi
Copy link

Expected behavior:
Submitting a comment using xid param should submit correctly

Actual behavior:
Throws polis_err_post_comment_bad_pid error

To Reproduce:

  1. Run up-to-date build from edge branch
  2. Create a conversation and embed it on a page using data-xid param
  3. Submit a comment on the embedded conversation

or

  1. Run up-to-date build from edge branch
  2. Create a conversation
  3. Send a POST request to /api/v3/comments with the following body:

{ "txt": "Comment text.", "pid": "mypid", "conversation_id": <conversation-id>, "vote": -1, "agid": 1, "xid": "any-xid" }

Additional context:

I dug into the handle_POST_comments() code and I think what's happening is an xid is being created without an equivalent pid before the function checks if it needs to create a pid. I managed to fix the issue with these changes:

lpalazzi@5dea271

Not sure if these changes break any intended functionality but it fixes the issue for me.

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

1 participant