diff --git a/meta/lib/oe/spdx30_tasks.py b/meta/lib/oe/spdx30_tasks.py
index 0618f2f139..bba11ae930 100644
--- a/meta/lib/oe/spdx30_tasks.py
+++ b/meta/lib/oe/spdx30_tasks.py
@@ -1068,7 +1068,7 @@ def create_rootfs_spdx(d):
         filenames.sort()
         for fn in filenames:
             fpath = Path(dirpath) / fn
-            if not fpath.is_file() or fpath.is_symlink():
+            if fpath.is_symlink() or not fpath.is_file():
                 continue
 
             relpath = str(fpath.relative_to(image_rootfs))
