Skip to content

Commit

Permalink
Added validation for acceptedFileExtensions in ving schemas being in …
Browse files Browse the repository at this point in the history
…the wrong place.
  • Loading branch information
rizen committed Oct 25, 2024
1 parent 4c59719 commit 97c10bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ving/docs/change-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ outline: deep
* Fix a bug in redis client where it wouldn't connect to the AWS valkey/redis cluster.
* Fix a hydration mismatch in form inputs subtext.
* Fix a hydration mismatch in markdown inputs.
* Added error hanlding to verifyExtension() in S3File.
* Added error handling to verifyExtension() in S3File.
* Added validation for acceptedFileExtensions in ving schemas being in the wrong place.

### 2024-10-24
* Installed dotenv for environment variables.
Expand Down
2 changes: 2 additions & 0 deletions ving/schema/validator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ export const validateRelationAcceptedFileExtensions = (prop, schema) => {
throw ving.ouch(442, `${formatPropPath(prop, schema)}.relation.acceptedFileExtensions should not exist.`);
return;
}
if (('acceptedFileExtensions' in prop)) // should not be a prop, if it exists it should be on relation
throw ving.ouch(442, `${formatPropPath(prop, schema)}.acceptedFileExtensions should be in the relation object, not the prop object.`);
if (!('acceptedFileExtensions' in prop.relation)) // optional
return;
if (!isArray(prop.relation.acceptedFileExtensions))
Expand Down

0 comments on commit 97c10bb

Please sign in to comment.