Move to SPDX licenses (#449)

* Move to SPDX licenses

Found a way to do this without breaking API compat, so here it is, instead of waiting for v3

Resolves MOD-129
Resolves #396

* License URL updates

* what was I thinking

* Do a thing

* Add open source filter

* Remove dead imports

* Borrow

* Update 20220910132835_spdx-licenses.sql

* Add license text route

* Update migration

* Address comments
This commit is contained in:
triphora
2022-11-29 23:53:24 -05:00
committed by GitHub
parent 34688852a4
commit 820519b4f7
15 changed files with 748 additions and 1007 deletions

View File

@@ -688,16 +688,16 @@ pub async fn project_create_inner(
)
})?;
let license_id = models::categories::License::get_id(
let license_id = spdx::Expression::parse(
&project_create_data.license_id,
&mut *transaction,
)
.await?
.ok_or_else(|| {
CreateError::InvalidInput(
"License specified does not exist.".to_string(),
)
.map_err(|err| {
CreateError::InvalidInput(format!(
"Invalid SPDX license identifier: {}",
err
))
})?;
let mut donation_urls = vec![];
if let Some(urls) = &project_create_data.donation_urls {
@@ -744,7 +744,7 @@ pub async fn project_create_inner(
status: status_id,
client_side: client_side_id,
server_side: server_side_id,
license: license_id,
license: license_id.to_string(),
slug: Some(project_create_data.slug),
donation_urls,
gallery_items: gallery_urls