diff --git a/doc.zih.tu-dresden.de/util/check-filesize.sh b/doc.zih.tu-dresden.de/util/check-filesize.sh
index 35fed9a7e4ad3133b36371c3e8f2766881b276eb..d1b9d4e643de0ce215e491747dd7abe7a174c373 100755
--- a/doc.zih.tu-dresden.de/util/check-filesize.sh
+++ b/doc.zih.tu-dresden.de/util/check-filesize.sh
@@ -34,11 +34,11 @@
 large_files_present=false
 branch="origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-preview}"
 source_hash=`git merge-base HEAD "${branch}"`
-lfsfiles=$(git lfs ls-files -n)
 
 for f in $(git diff --name-only --diff-filter=d ${source_hash}); do
     # Do not check size of git lfs files.
-    if [[ ${lfsfiles} =~ "${f}" ]]; then
+    filter_attribute=$(git check-attr filter -- "${f}")
+    if [[ "${filter_attribute#*: filter: }" = "lfs" ]]; then
         echo "Skip file ${f} because it is a git lfs file."
         continue
     fi