mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-31 21:21:03 -04:00
535c97e8cf
[frontend] import meta tag processing from das7pads fork GitOrigin-RevId: ca74ff9fbbcb51091a626a45468ff3d24d6136ca
31 lines
803 B
Bash
Executable file
31 lines
803 B
Bash
Executable file
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
TEMPLATES_EXTENDING_META_BLOCK=$(\
|
|
grep \
|
|
--files-with-matches \
|
|
--recursive app/views modules/*/app/views \
|
|
--regex 'block append meta' \
|
|
--regex 'block prepend meta' \
|
|
--regex 'append meta' \
|
|
--regex 'prepend meta' \
|
|
)
|
|
|
|
for file in ${TEMPLATES_EXTENDING_META_BLOCK}; do
|
|
if ! grep "$file" --quiet --extended-regexp -e 'extends .+layout'; then
|
|
cat <<MSG >&2
|
|
|
|
ERROR: $file is a partial template and extends 'block meta'.
|
|
|
|
Using block append/prepend in a partial will duplicate the block contents into
|
|
the <body> due to a bug in pug.
|
|
Putting meta tags in the <body> can lead to Angular XSS.
|
|
|
|
You will need to refactor the partial and move the block into the top level
|
|
page template that extends the global layout.pug.
|
|
|
|
MSG
|
|
exit 1
|
|
fi
|
|
done
|