More reasonable length restrictions (#458)
This commit is contained in:
parent
75b7583832
commit
3e52f804a7
@ -130,7 +130,7 @@ fn default_project_type() -> String {
|
|||||||
|
|
||||||
#[derive(Serialize, Deserialize, Validate, Clone)]
|
#[derive(Serialize, Deserialize, Validate, Clone)]
|
||||||
struct ProjectCreateData {
|
struct ProjectCreateData {
|
||||||
#[validate(length(min = 3, max = 256))]
|
#[validate(length(min = 3, max = 64))]
|
||||||
#[serde(alias = "mod_name")]
|
#[serde(alias = "mod_name")]
|
||||||
/// The title or name of the project.
|
/// The title or name of the project.
|
||||||
pub title: String,
|
pub title: String,
|
||||||
@ -145,7 +145,7 @@ struct ProjectCreateData {
|
|||||||
#[serde(alias = "mod_slug")]
|
#[serde(alias = "mod_slug")]
|
||||||
/// The slug of a project, used for vanity URLs
|
/// The slug of a project, used for vanity URLs
|
||||||
pub slug: String,
|
pub slug: String,
|
||||||
#[validate(length(min = 3, max = 2048))]
|
#[validate(length(min = 3, max = 255))]
|
||||||
#[serde(alias = "mod_description")]
|
#[serde(alias = "mod_description")]
|
||||||
/// A short description of the project.
|
/// A short description of the project.
|
||||||
pub description: String,
|
pub description: String,
|
||||||
|
|||||||
@ -251,9 +251,9 @@ pub async fn dependency_list(
|
|||||||
/// A project returned from the API
|
/// A project returned from the API
|
||||||
#[derive(Serialize, Deserialize, Validate)]
|
#[derive(Serialize, Deserialize, Validate)]
|
||||||
pub struct EditProject {
|
pub struct EditProject {
|
||||||
#[validate(length(min = 3, max = 256))]
|
#[validate(length(min = 3, max = 64))]
|
||||||
pub title: Option<String>,
|
pub title: Option<String>,
|
||||||
#[validate(length(min = 3, max = 2048))]
|
#[validate(length(min = 3, max = 256))]
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
#[validate(length(max = 65536))]
|
#[validate(length(max = 65536))]
|
||||||
pub body: Option<String>,
|
pub body: Option<String>,
|
||||||
|
|||||||
@ -130,21 +130,21 @@ lazy_static! {
|
|||||||
|
|
||||||
#[derive(Serialize, Deserialize, Validate)]
|
#[derive(Serialize, Deserialize, Validate)]
|
||||||
pub struct EditUser {
|
pub struct EditUser {
|
||||||
#[validate(length(min = 1, max = 255), regex = "RE_URL_SAFE")]
|
#[validate(length(min = 1, max = 39), regex = "RE_URL_SAFE")]
|
||||||
pub username: Option<String>,
|
pub username: Option<String>,
|
||||||
#[serde(
|
#[serde(
|
||||||
default,
|
default,
|
||||||
skip_serializing_if = "Option::is_none",
|
skip_serializing_if = "Option::is_none",
|
||||||
with = "::serde_with::rust::double_option"
|
with = "::serde_with::rust::double_option"
|
||||||
)]
|
)]
|
||||||
#[validate(length(min = 1, max = 255), regex = "RE_URL_SAFE")]
|
#[validate(length(min = 1, max = 64), regex = "RE_URL_SAFE")]
|
||||||
pub name: Option<Option<String>>,
|
pub name: Option<Option<String>>,
|
||||||
#[serde(
|
#[serde(
|
||||||
default,
|
default,
|
||||||
skip_serializing_if = "Option::is_none",
|
skip_serializing_if = "Option::is_none",
|
||||||
with = "::serde_with::rust::double_option"
|
with = "::serde_with::rust::double_option"
|
||||||
)]
|
)]
|
||||||
#[validate(email)]
|
#[validate(email, length(max = 2048))]
|
||||||
pub email: Option<Option<String>>,
|
pub email: Option<Option<String>>,
|
||||||
#[serde(
|
#[serde(
|
||||||
default,
|
default,
|
||||||
|
|||||||
@ -32,11 +32,11 @@ pub struct InitialVersionData {
|
|||||||
#[validate(length(min = 1, max = 256))]
|
#[validate(length(min = 1, max = 256))]
|
||||||
pub file_parts: Vec<String>,
|
pub file_parts: Vec<String>,
|
||||||
#[validate(
|
#[validate(
|
||||||
length(min = 1, max = 64),
|
length(min = 1, max = 32),
|
||||||
regex = "crate::util::validate::RE_URL_SAFE"
|
regex = "crate::util::validate::RE_URL_SAFE"
|
||||||
)]
|
)]
|
||||||
pub version_number: String,
|
pub version_number: String,
|
||||||
#[validate(length(min = 1, max = 256))]
|
#[validate(length(min = 1, max = 64))]
|
||||||
#[serde(alias = "name")]
|
#[serde(alias = "name")]
|
||||||
pub version_title: String,
|
pub version_title: String,
|
||||||
#[validate(length(max = 65536))]
|
#[validate(length(max = 65536))]
|
||||||
|
|||||||
@ -167,10 +167,10 @@ pub async fn version_get(
|
|||||||
|
|
||||||
#[derive(Serialize, Deserialize, Validate)]
|
#[derive(Serialize, Deserialize, Validate)]
|
||||||
pub struct EditVersion {
|
pub struct EditVersion {
|
||||||
#[validate(length(min = 1, max = 256))]
|
#[validate(length(min = 1, max = 64))]
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
#[validate(
|
#[validate(
|
||||||
length(min = 1, max = 64),
|
length(min = 1, max = 32),
|
||||||
regex = "crate::util::validate::RE_URL_SAFE"
|
regex = "crate::util::validate::RE_URL_SAFE"
|
||||||
)]
|
)]
|
||||||
pub version_number: Option<String>,
|
pub version_number: Option<String>,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user