# Buggy code
def _recipe_files_to_upload(self, ref, policy, the_files, remote, remote_manifest):
    # Get the remote snapshot
    self._remote_manager.check_credentials(remote)
    remote_snapshot = self._remote_manager.get_recipe_snapshot(ref, remote)

    if remote_snapshot and policy != UPLOAD_POLICY_FORCE:
        local_manifest = FileTreeManifest.loads(load(the_files["conanmanifest.txt"]))

        if remote_manifest == local_manifest:
            return None, None

        if policy in (UPLOAD_POLICY_NO_OVERWRITE, UPLOAD_POLICY_NO_OVERWRITE_RECIPE):
            raise ConanException(
                "Local recipe is different from the remote recipe. Forbidden overwrite."
            )

    files_to_upload = {
        filename.replace("\\", "/"): path for filename, path in the_files.items()
    }
    deleted = set(remote_snapshot).difference(the_files)
    return files_to_upload, deleted


# Traceback (AttributeError)
[b] $ sh -c "conan upload \* -r 090a7942-cd0f-45af-9347-465cbbe94a6e --confirm --all --no-overwrite "
MicroblinkConanFile/3.0.2@microblink/stable: Not found in local cache, looking in remotes...
MicroblinkConanFile/3.0.2@microblink/stable: Trying with '090a7942-cd0f-45af-9347-465cbbe94a6e'...
Downloading conanmanifest.txt

Downloading conanfile.py

MicroblinkConanFile/3.0.2@microblink/stable: Downloaded recipe revision 0
Uploading to remote '090a7942-cd0f-45af-9347-465cbbe94a6e':
Uploading CoreUtils/2.2.0@microblink/master to remote '090a7942-cd0f-45af-9347-465cbbe94a6e'
Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/conans/client/command.py", line 1579, in run
method(args[0][1:])
File "/usr/lib/python3.7/site-packages/conans/client/command.py", line 1182, in upload
retry_wait=args.retry_wait, integrity_check=args.check)
File "/usr/lib/python3.7/site-packages/conans/client/conan_api.py", line 93, in wrapper
return f(*args, **kwargs)
File "/usr/lib/python3.7/site-packages/conans/client/conan_api.py", line 868, in upload
retry_wait, integrity_check, policy, remote_name, query=query)
File "/usr/lib/python3.7/site-packages/conans/client/cmd/uploader.py", line 88, in upload
integrity_check, policy, remote, upload_recorder)
File "/usr/lib/python3.7/site-packages/conans/client/cmd/uploader.py", line 190, in _upload_ref
self._upload_recipe(ref, conanfile, retry, retry_wait, policy, recipe_remote)
File "/usr/lib/python3.7/site-packages/conans/client/cmd/uploader.py", line 230, in _upload_recipe
remote, remote_manifest)
File "/usr/lib/python3.7/site-packages/conans/client/cmd/uploader.py", line 344, in _recipe_files_to_upload
if remote_manifest == local_manifest:
File "/usr/lib/python3.7/site-packages/conans/model/manifest.py", line 132, in __eq__
return self.file_sums == other.file_sums
AttributeError: 'NoneType' object has no attribute 'file_sums'

ERROR: 'NoneType' object has no attribute 'file_sums'

# Fixed code
def _recipe_files_to_upload(
    self, ref, policy, the_files, remote, remote_manifest, local_manifest
):
    self._remote_manager.check_credentials(remote)
    remote_snapshot = self._remote_manager.get_recipe_snapshot(ref, remote)
    files_to_upload = {
        filename.replace("\\", "/"): path for filename, path in the_files.items()
    }
    if not remote_snapshot:
        return files_to_upload, set()

    deleted = set(remote_snapshot).difference(the_files)
    if policy != UPLOAD_POLICY_FORCE:
        if remote_manifest is None:
            # This is the weird scenario, we have a snapshot but don't have a manifest.
            # Can be due to concurrency issues, so we can try retrieve it now
            try:
                remote_manifest, _ = self._remote_manager.get_recipe_manifest(
                    ref, remote
                )
            except NotFoundException:
                # This is weird, the manifest still not there, better upload everything
                self._user_io.out.warn(
                    "The remote recipe doesn't have the 'conanmanifest.txt' "
                    "file and will be uploaded: '{}'".format(ref)
                )
                return files_to_upload, deleted

        if remote_manifest == local_manifest:
            return None, None

        if policy in (UPLOAD_POLICY_NO_OVERWRITE, UPLOAD_POLICY_NO_OVERWRITE_RECIPE):
            raise ConanException(
                "Local recipe is different from the remote recipe. Forbidden overwrite."
            )

    return files_to_upload, deleted