Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • G go
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Kirill Smelkov
  • go
  • Repository
You need to sign in or sign up before continuing.
  • go
  • src
  • encoding
  • json
  • encode.go
Find file BlameHistoryPermalink
  • Daniel Martí's avatar
    encoding/json: obey SetEscapeHTML in all MarshalJSON cases · 13327f21
    Daniel Martí authored Jul 02, 2019
    It wasn't obeyed in the case where the MarshalJSON method uses a pointer
    receiver, and the encoder grabs the address of a value to find that
    method. addrMarshalerEncoder is the function that does this work, but it
    ignored opts.escapeHTML.
    
    Here's the before and after of the added test case, which was failing
    before the fix. Now the two cases are correct and consistent.
    
    	{"NonPtr":"<str>","Ptr":"\u003cstr\u003e"}
    	{"NonPtr":"<str>","Ptr":"<str>"}
    
    Fixes #32896.
    
    Change-Id: Idc53077ece074973558bd3bb5ad036380db0d02c
    Reviewed-on: https://go-review.googlesource.com/c/go/+/184757
    
    
    Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarEmmanuel Odeke <emm.odeke@gmail.com>
    Reviewed-by: default avatarCaleb Spare <cespare@gmail.com>
    13327f21
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7