def test_symbolic_link_in_base_dir(self):
        """symbolic link within the base directory is correctly processed."""
        symlink_path = os.path.join(self.base_dir, "symlink.txt")
        target_path = os.path.join(self.base_dir, "target.txt")

        # Create a target file and then a symbolic link pointing to it.
        with open(target_path, "w") as f:
            f.write("target")
        os.symlink(target_path, symlink_path)

        # Add the symbolic link to the tar archive.
        with tarfile.open(self.tar_path, "w") as tar:
            tar.add(symlink_path, arcname="symlink.txt")

        with tarfile.open(self.tar_path, "r") as tar:
            members = list(file_utils.filter_safe_paths(tar.getmembers()))
            self.assertEqual(len(members), 1)
            self.assertEqual(members[0].name, "symlink.txt")
            self.assertTrue(
                members[0].issym()
            )  # Explicitly assert it's a symbolic link.

        os.remove(symlink_path)
        os.remove(target_path)
symbolic link within the base directory is correctly processed.
keras/src/utils/file_utils_test.py