mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 11:57:07 +02:00
bug(auth): Make API keys accept Null descriptions
This commit is contained in:
parent
622c15e825
commit
3bee31e6c7
2 changed files with 43 additions and 7 deletions
|
@ -20,13 +20,14 @@ pub struct Key {
|
|||
|
||||
impl Key {
|
||||
pub fn create_from_value(value: Value) -> Result<Self> {
|
||||
let description = value
|
||||
.get("description")
|
||||
.map(|des| {
|
||||
let description = match value.get("description") {
|
||||
Some(Value::Null) => None,
|
||||
Some(des) => Some(
|
||||
from_value(des.clone())
|
||||
.map_err(|_| AuthControllerError::InvalidApiKeyDescription(des.clone()))
|
||||
})
|
||||
.transpose()?;
|
||||
.map_err(|_| AuthControllerError::InvalidApiKeyDescription(des.clone()))?,
|
||||
),
|
||||
None => None,
|
||||
};
|
||||
|
||||
let id = generate_id();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue