Skip to content

Commit 39facfd

Browse files
committed
Avoid enforcing URL check on initial publish
1 parent 351d602 commit 39facfd

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

crates/uv-publish/src/lib.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use std::{env, fmt, io};
2121
use thiserror::Error;
2222
use tokio::io::{AsyncReadExt, BufReader};
2323
use tokio_util::io::ReaderStream;
24-
use tracing::{debug, enabled, trace, Level};
24+
use tracing::{debug, enabled, trace, warn, Level};
2525
use url::Url;
2626
use uv_client::{BaseClient, OwnedArchive, RegistryClientBuilder, UvRetryableStrategy};
2727
use uv_configuration::{KeyringProviderType, TrustedPublishing};
@@ -469,10 +469,24 @@ pub async fn check_url(
469469
.wrap_existing(client);
470470

471471
debug!("Checking for {filename} in the registry");
472-
let response = registry_client
472+
let response = match registry_client
473473
.simple(filename.name(), Some(index_url), index_capabilities)
474474
.await
475-
.map_err(PublishError::CheckUrlIndex)?;
475+
{
476+
Ok(response) => response,
477+
Err(err) => {
478+
return match err.into_kind() {
479+
uv_client::ErrorKind::PackageNotFound(_) => {
480+
// The package doesn't exist, so we can't have uploaded it.
481+
warn!(
482+
"Package not found in the registry; skipping upload check for {filename}"
483+
);
484+
Ok(false)
485+
}
486+
kind => Err(PublishError::CheckUrlIndex(kind.into())),
487+
};
488+
}
489+
};
476490
let [(_, simple_metadata)] = response.as_slice() else {
477491
unreachable!("We queried a single index, we must get a single response");
478492
};

0 commit comments

Comments
 (0)