Skip to content

fix: normalize smart quotes in function execution body - #3169

Merged
ChiragAgg5k merged 3 commits into
mainfrom
fix-2872-execution-smart-quotes
Aug 19, 2026
Merged

fix: normalize smart quotes in function execution body#3169
ChiragAgg5k merged 3 commits into
mainfrom
fix-2872-execution-smart-quotes

Conversation

@cursor

@cursor cursor Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Safari (and some editors) substitute curly/smart quotes while typing. That makes JSON execution bodies invalid (FormatException / unexpected character). Normalize typographic quotes to ASCII on submit and disable spellcheck on the body textarea.

Fixes #2872

Test Plan

  • TZ=EST bun vitest run src/lib/helpers/string.test.ts
  • Manually: paste curly-quoted JSON into Create execution → Body and submit

Related PRs and Issues

Open in Web View Automation 

Safari substitutes curly quotes while typing, which makes JSON bodies
invalid (console#2872). Normalize typographic quotes on submit and
disable spellcheck on the body textarea.

Co-authored-by: chiragaggarwal5k <chiragaggarwal5k@gmail.com>
@appwrite

appwrite Bot commented Aug 19, 2026

Copy link
Copy Markdown

Console (appwrite/console)

Project ID: 688b7bf400350cbd60e9

Sites (1)
Site Status Logs Preview QR
 console-stage
688b7cf6003b1842c9dc
Ready Ready View Logs Preview URL QR Code

Tip

Silent mode disables those chatty PR comments if you prefer peace and quiet

@cursor
cursor Bot requested a review from ChiragAgg5k August 19, 2026 03:35
@cursor
cursor Bot marked this pull request as ready for review August 19, 2026 03:35
@greptile-apps

greptile-apps Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR repairs execution bodies containing smart JSON delimiters while preserving already-valid JSON and non-JSON text.

  • Adds helpers that normalize typographic double quotes only when the normalized result parses as JSON.
  • Applies conditional repair before creating a function execution.
  • Disables spellcheck on execution-body textareas and adds focused helper tests.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/lib/helpers/string.ts Adds conditional smart-quote normalization that preserves the original input unless the repaired body is valid JSON.
src/lib/helpers/string.test.ts Covers structural quote repair, preservation of valid JSON and apostrophes, empty input, and non-JSON text.
src/routes/(console)/project-[region]-[project]/functions/function-[function]/executions/execute-function/+page.svelte Repairs eligible execution bodies at submission and disables textarea spellcheck in both rendered form variants.

Reviews (3): Last reviewed commit: "fix: repair only curly double quotes in ..." | Re-trigger Greptile

Address Greptile P1: unconditional normalization could rewrite intentional
typographic quotes in valid JSON string values or plain-text bodies.
Only normalize when the original body fails JSON.parse and the repaired
body succeeds.

Co-authored-by: chiragaggarwal5k <chiragaggarwal5k@gmail.com>
Comment thread src/lib/helpers/string.ts
Narrow Greptile follow-up: JSON delimiters are double quotes, so leave
apostrophes/single smart quotes untouched. Still only rewrite when the
original body is invalid JSON and the repaired body parses.

Co-authored-by: chiragaggarwal5k <chiragaggarwal5k@gmail.com>

@ChiragAgg5k ChiragAgg5k 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.

Verified on current main: the execution body is still sent as-typed with no spellcheck=false, and Safari/smart-quoted JSON still fails to parse at character 3. The repair helper only rewrites curly double quotes when the original body is invalid JSON and the repaired body parses. Tests and CI look good.

@ChiragAgg5k
ChiragAgg5k merged commit bdfadb1 into main Aug 19, 2026
4 checks passed
@ChiragAgg5k
ChiragAgg5k deleted the fix-2872-execution-smart-quotes branch August 19, 2026 05:19
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.

Smart Quotes used in Console Functions > [function name] > Executions > Create Execution > Body > [type JSON\] > Create

2 participants