Repository: astral-sh/uv
File: crates/uv/src/commands/publish.rs (Rust)

Code before:
            index_url: index_url.clone(),
            registry_client_builder,
            client: &upload_client,
            index_capabilities: IndexCapabilities::default(),
            cache,
        })
    } else {
        None
    };

    for group in groups {
        // Check if the filename is normalized (e.g., version `2025.09.4` should be `2025.9.4`).
        let normalized_filename = group.filename.to_string();
        if group.raw_filename != normalized_filename {
            if preview.is_enabled(PreviewFeature::PublishRequireNormalized) {
                warn_user_once!(
                    "`{}` has a non-normalized filename (expected `{normalized_filename}`), skipping",
                    group.raw_filename
                );
                continue;
            }
            warn_user_once!(
                "`{}` has a non-normalized filename (expected `{normalized_filename}`). \
                Pass `--preview-features {}` to skip such files.",
                group.raw_filename,
                PreviewFeature::PublishRequireNormalized
            );
        }

        if let Some(check_url_client) = &check_url_client {
            if uv_publish::check_url(
                check_url_client,
                &group.file,
                &group.filename,
                &download_concurrency,
            )
            .await?
            {
                writeln!(
                    printer.stderr(),
                    "File {} already exists, skipping",
                    group.filename
                )?;
                continue;
            }
        }

        let size = fs_err::metadata(&group.file)?.len();
        let (bytes, unit) = human_readable_bytes(size);
        if dry_run {
            writeln!(

Review comment (bug):
One scenario where would go wrong: You have a script that changes the filename for let's say mac (inspired by real events), and now you have an upload for the a release on PyPI except that mac is missing.

Code after:
            RegistryClientBuilder::new(client_builder.clone(), cache.clone())
                .index_locations(index_locations)
                .keyring(keyring_provider);
        Some(CheckUrlClient {
            index_url: index_url.clone(),
            registry_client_builder,
            client: &upload_client,
            index_capabilities: IndexCapabilities::default(),
            cache,
        })
    } else {
        None
    };

    let mut error_count: usize = 0;

    for group in groups {
        // Check if the filename is normalized (e.g., version `2025.09.4` should be `2025.9.4`).
        let normalized_filename = group.filename.to_string();
        if group.raw_filename != normalized_filename {
            if preview.is_enabled(PreviewFeature::PublishRequireNormalized) {
                warn_user_once!(
                    "`{}` has a non-normalized filename (expected `{normalized_filename}`), skipping",
                    group.raw_filename
                );
                continue;
            }
            warn_user_once!(
                "`{}` has a non-normalized filename (expected `{normalized_filename}`). \
                Pass `--preview-features {}` to skip such files.",
                group.raw_filename,
                PreviewFeature::PublishRequireNormalized
            );
        }

        if let Some(check_url_client) = &check_url_client {
            match uv_publish::check_url(
                check_url_client,
                &group.file,
                &group.filename,
                &download_concurrency,
            )
            .await
            {
                Ok(true) => {
                    writeln!(
                        printer.stderr(),
                        "File {} already exists, skipping",
                        group.filename
                    )?;
                    continue;