Skip to content

Fix DELETE /v1/note/share to parse ID from JSON request body - #65

Merged
egeozcan merged 3 commits into
masterfrom
fix-share-delete-json-3263962093540364728
Oct 6, 2026
Merged

egeozcan merged 3 commits into
masterfrom
fix-share-delete-json-3263962093540364728

Conversation

@egeozcan

@egeozcan egeozcan commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Fix DELETE /v1/note/share to correctly extract the note ID from a JSON request body instead of only query parameters.

The endpoint used http_utils.GetUIntFormValue which ignores JSON payloads. Added logic to parse the request body and fallback to unmarshaling JSON to retrieve id or noteId.


PR created automatically by Jules for task 3263962093540364728 started by @egeozcan

…N request body instead of only query parameters.

The endpoint used `http_utils.GetUIntFormValue` which ignores JSON payloads. Added logic to parse the request body and fallback to unmarshaling JSON to retrieve `id` or `noteId`.

Co-authored-by: egeozcan <185294+egeozcan@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

The PR's float64 conversion truncated 1.5 to 1 and wrapped negative or
huge values onto other notes, read an unbounded body, and ignored the
Content-Type. Decode json.Number through parseUintStrict instead, cap the
body, only look when the request is JSON, and document the body form.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@egeozcan

egeozcan commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

Review findings, all fixed in the pushed commit:

  • float64 to uint conversion truncated 1.5 to 1 and wrapped negative or huge values onto other notes. Now json.Number through parseUintStrict; non-whole or non-positive IDs answer 400.
  • The body was read unbounded and regardless of Content-Type. Now only for application/json, capped at 4 KiB.
  • Imports were not gofmt-ordered.
  • No tests: added api_tests for noteId, id, invalid values (note must stay shared) and query-string precedence.
  • Docs: docs-site/docs/api/notes.md now describes the JSON body.
    Compatibility: query string and form IDs behave as before and still take precedence. The mr CLI uses the query string and is unchanged. POST /v1/note/share still does not read a JSON body (out of scope here). OpenAPI RouteInfo has no request-body field for this route, so the spec is unchanged.

@google-labs-jules

Copy link
Copy Markdown
Contributor

Review findings, all fixed in the pushed commit:

  • float64 to uint conversion truncated 1.5 to 1 and wrapped negative or huge values onto other notes. Now json.Number through parseUintStrict; non-whole or non-positive IDs answer 400.
  • The body was read unbounded and regardless of Content-Type. Now only for application/json, capped at 4 KiB.
  • Imports were not gofmt-ordered.
  • No tests: added api_tests for noteId, id, invalid values (note must stay shared) and query-string precedence.
  • Docs: docs-site/docs/api/notes.md now describes the JSON body.
    Compatibility: query string and form IDs behave as before and still take precedence. The mr CLI uses the query string and is unchanged. POST /v1/note/share still does not read a JSON body (out of scope here). OpenAPI RouteInfo has no request-body field for this route, so the spec is unchanged.

Acknowledged. I've fetched the changes pushed by the user and confirmed the tests are passing.

…N request body instead of only query parameters.

The endpoint used `http_utils.GetUIntFormValue` which ignores JSON payloads. Added logic to parse the request body and fallback to unmarshaling JSON to retrieve `id` or `noteId`.

Co-authored-by: egeozcan <185294+egeozcan@users.noreply.github.com>
@egeozcan
egeozcan merged commit 70490b9 into master Oct 6, 2026
6 checks passed
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.

1 participant