Skip to content

Commit 57be002

Browse files
committed
Run template parser compatibility patch
1 parent c77c6e5 commit 57be002

1 file changed

Lines changed: 4 additions & 24 deletions

File tree

‎.github/workflows/fix-302-template-parser-regression.yml‎

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,11 @@ jobs:
1313
- uses: actions/checkout@v4
1414
with:
1515
ref: security/javascript-placeholder-bindings
16-
- name: Restore template delimiter handling
16+
- name: Apply compatibility fix
17+
run: python3 .github/fix-302-template-parser.py
18+
- name: Commit compatibility fix
1719
run: |
18-
python3 - <<'PY'
19-
from pathlib import Path
20-
p = Path('AdvancedCore/src/main/java/com/bencodez/advancedcore/api/javascript/JavascriptPlaceholderBinder.java')
21-
text = p.read_text()
22-
old = ''' } else if (string != null) {
23-
char delimiter = literalDelimiter(expression, string);
24-
replacements[i] = escapeString(match.value, delimiter);
25-
} else {
26-
'''
27-
new = ''' } else if (string != null) {
28-
char delimiter = literalDelimiter(expression, string);
29-
if (delimiter == '`' && !contexts.insideTemplateExpression(match.start)) {
30-
replacements[i] = escapeTemplate(match.value);
31-
} else {
32-
replacements[i] = escapeString(match.value, delimiter);
33-
}
34-
} else {
35-
'''
36-
if text.count(old) != 1:
37-
raise SystemExit('template string branch not found')
38-
p.write_text(text.replace(old, new, 1))
39-
PY
40-
rm -f .github/workflows/fix-302-template-parser-regression.yml
20+
rm -f .github/fix-302-template-parser.py .github/workflows/fix-302-template-parser-regression.yml
4121
git config user.name 'Ben'
4222
git config user.email 'benbergen12@gmail.com'
4323
git add -A

0 commit comments

Comments
 (0)