Skip to content

Commit c772010

Browse files
committed
publish: Save description, homepage, documentation and repository fields in the database
1 parent 4a00cd1 commit c772010

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/controllers/krate/publish.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ pub async fn publish(app: AppState, req: BytesRequest) -> AppResult<Json<GoodCra
9292

9393
if let Some(deleted_crate) = deleted_crate {
9494
return Err(bad_request(format!(
95-
"A crate with the name `{}` was recently deleted. Reuse of this name will be available after {}.",
96-
deleted_crate.0,
97-
deleted_crate.1.to_rfc3339_opts(SecondsFormat::Secs, true)
98-
)));
95+
"A crate with the name `{}` was recently deleted. Reuse of this name will be available after {}.",
96+
deleted_crate.0,
97+
deleted_crate.1.to_rfc3339_opts(SecondsFormat::Secs, true)
98+
)));
9999
}
100100

101101
// this query should only be used for the endpoint scope calculation
@@ -394,6 +394,10 @@ pub async fn publish(app: AppState, req: BytesRequest) -> AppResult<Json<GoodCra
394394
.has_lib(tarball_info.manifest.lib.is_some())
395395
.bin_names(bin_names.as_slice())
396396
.maybe_edition(edition)
397+
.maybe_description(description.as_deref())
398+
.maybe_homepage(homepage.as_deref())
399+
.maybe_documentation(documentation.as_deref())
400+
.maybe_repository(repository.as_deref())
397401
.build();
398402

399403
let version = new_version.save(conn, &verified_email_address).await.map_err(|error| {

src/models/version.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ pub struct NewVersion<'a> {
9999
pub has_lib: Option<bool>,
100100
pub bin_names: Option<&'a [&'a str]>,
101101
edition: Option<&'a str>,
102+
description: Option<&'a str>,
103+
homepage: Option<&'a str>,
104+
documentation: Option<&'a str>,
105+
repository: Option<&'a str>,
102106
}
103107

104108
impl NewVersion<'_> {

0 commit comments

Comments
 (0)