allow empty values to be provided to insert for system cols
This commit is contained in:
parent
f557654da8
commit
37d0922fd3
1 changed files with 9 additions and 1 deletions
|
|
@ -81,7 +81,15 @@ pub(super) async fn post(
|
|||
let col_names: Vec<String> = form.keys().cloned().collect();
|
||||
|
||||
// Prevent users from modifying Phonograph metadata columns.
|
||||
if col_names.iter().any(|col| col.starts_with('_')) {
|
||||
if form.iter().any(|(col, values)| {
|
||||
col.starts_with('_')
|
||||
&& values.iter().any(|value| {
|
||||
serde_json::from_str::<Datum>(value)
|
||||
.ok()
|
||||
.map(|value| !value.is_none())
|
||||
.unwrap_or(false)
|
||||
})
|
||||
}) {
|
||||
return Err(forbidden!("access denied to update system metadata column"));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue