bin/replace_missing_fonts.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
New commits: commit 5c3ac53ec31d2b33ad7197c2d20c38c5035b3ba6 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu Mar 7 13:08:24 2024 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu Mar 7 15:29:30 2024 +0100 replace_missing_fonts: Only replace string if between quotes Change-Id: Id7d1b4326cf37250c3ae6d163223e1a492fbfde4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164535 Tested-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/bin/replace_missing_fonts.sh b/bin/replace_missing_fonts.sh index 5fcee528edc3..3dd078dc89e5 100755 --- a/bin/replace_missing_fonts.sh +++ b/bin/replace_missing_fonts.sh @@ -45,9 +45,13 @@ for file in $(find "$1" -type f); do file_changed=false value=${replacements[$key]} for subfile in $(find "$extracted_folder" -type f); do - if grep -q "$key" "$subfile"; then - # use sed to replace the string in the file if it exists - sed -i "s/$key/$value/g" "$subfile" + # Replace only if it's between quotes + if grep -q "\"$key\"" "$subfile"; then + sed -i "s/\"$key\"/\"$value\"/g" "$subfile" + file_changed=true + # or between '"' + elif grep -q ""$key"" "$subfile"; then + sed -i "s/"$key"/\"$value\"/g" "$subfile" file_changed=true fi done