fix: resolve template literal syntax error in add_product.html#1064
Open
torbenbrodt wants to merge 1 commit intoprebid:mainfrom
Open
fix: resolve template literal syntax error in add_product.html#1064torbenbrodt wants to merge 1 commit intoprebid:mainfrom
torbenbrodt wants to merge 1 commit intoprebid:mainfrom
Conversation
Contributor
|
All contributors have agreed to the IPR Policy. Thank you! |
Author
|
I have read the IPR Policy |
d40866a to
bf4ce83
Compare
- Remove incorrect double backslash escaping in template literals
- Change ${index} to in addPricingOption() and removePricingOption()
- Fixes 'Invalid or unexpected token' JavaScript error on add product page
bf4ce83 to
c02b301
Compare
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.
Summary
Fixes a JavaScript
Invalid or unexpected tokenerror on the Add Product page caused by incorrect double-backslash escaping of template literals inside a Jinja2<script>block.Problem
In
templates/add_product.html, JavaScript template literals inaddPricingOption()andremovePricingOption()were written with escaped backticks and\${index}interpolations. Since Jinja2 does not process content inside<script>tags (only{{ }}/{% %}delimiters are parsed), the backslashes were rendered literally into the JavaScript output, causing a syntax error at runtime.Fix
Removed the incorrect backslash escaping so plain ES6 template literals are used:
Before:
After:
Files Changed
templates/add_product.html— 20 lines (backslash escaping removed from template literals)