Repository navigation
Encode the text customers enter when it goes into a message - #1091
Merged
Merged
Conversation
Message tokens with text a customer typed (names, addresses, e-mails, phone numbers, comments, reviews, gift voucher names) were inserted into the e-mail body as they were. A name with HTML in it became HTML in the e-mail to the store owner, and again in the admin panel when the queued e-mail was opened for editing. The drops now HTML-encode that text, as they already did for product names and the purchase order number. Text the callers had already encoded (contact enquiries, ask-a-question and e-mail-a-friend messages, notes) is left alone. A subject is plain text, so it is decoded after rendering and a name like O'Brien stays readable there.
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.
Message tokens with text a customer typed were inserted into the e-mail body as they were. A first name with HTML in it became HTML in the e-mail sent to the store owner, and again in the admin panel when that queued e-mail was opened for editing, since the editor shows the body as HTML.
Changes
LiquidCustomer: e-mail, username, names, gender, date of birth, company, address fields, phone, fax, VAT number, note titleLiquidOrder: customer name and e-mail, billing and shipping address fields, VAT number, vendor name and e-mailLiquidMerchandiseReturn: pickup address fieldsLiquidVendor(name, e-mail, address fields),LiquidVendorReview,LiquidGiftVoucher(sender and recipient),LiquidNewsComment,LiquidBlogComment,LiquidKnowledgebasecomment,LiquidNewsLetterSubscriptione-mailLiquidAskQuestion,LiquidEmailAFriend,LiquidContactUs: e-mails, names and phone. Their message bodies are already encoded by the callers and are left alone.LiquidExtensions.RenderSubject(new): renders a subject and decodes it, because a subject is plain text. Used byMessageProviderService,CatalogMessageProviderServiceandCampaignMessageRenderer, so a name like O'Brien does not show asO'Brien.Notes
Tests
LiquidCustomerTests: customer text is encoded; a subject comes out as plain text while the body stays encoded.LiquidOrderTests: billing and shipping text is encoded.Grand.Business.Messages.Tests(171),Grand.Business.Marketing.Tests(162),Grand.Web.Tests(655),Grand.Business.Checkout.Tests(1116) pass.