mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-24 05:22:51 +00:00
1ff186a738
[web] sort all the locale files and check sorting in CI GitOrigin-RevId: 5921e24f22e2ca126f7d49a1956b44d810b52dcd
37 lines
719 B
Bash
Executable file
37 lines
719 B
Bash
Executable file
#!/bin/bash
|
||
|
||
set -e
|
||
|
||
# Ensure all locale files are sorted.
|
||
node scripts/translations/sort.js --check
|
||
|
||
# Ensure no locales contain single quotes.
|
||
LOCALES_WITH_SINGLE_QUOTE=$(\
|
||
grep \
|
||
--files-with-matches \
|
||
--recursive locales/ \
|
||
--regex "'" \
|
||
|| true
|
||
)
|
||
|
||
for file in ${LOCALES_WITH_SINGLE_QUOTE}; do
|
||
cat <<MSG >&2
|
||
|
||
ERROR: $file contains a locale with a single quote.
|
||
|
||
---
|
||
$(grep "$file" --regex "'")
|
||
---
|
||
|
||
Using single quotes in locales can lead to Angular XSS.
|
||
|
||
You will need to replace the quote with a similar looking character.
|
||
’ (\u2019) is a good candidate.
|
||
|
||
Links:
|
||
- https://en.wikipedia.org/wiki/Right_single_quotation_mark
|
||
- https://github.com/overleaf/issues/issues/4478
|
||
|
||
MSG
|
||
exit 1
|
||
done
|