Skip to content

Commit

Permalink
fix faulty payload check
Browse files Browse the repository at this point in the history
  • Loading branch information
0x8890 committed Sep 10, 2015
1 parent bc2f21b commit 22e7161
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions doc/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog


##### 1.3.8 (2015-09-10)
- Fix: faulty check for invalid create/update payloads.


##### 1.3.7 (2015-09-10)
- Fix: check for invalid create/update payloads which have the same ID in multiple records for a to-one relationship.

Expand Down
4 changes: 2 additions & 2 deletions lib/dispatch/validate_records.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export default function validateRecords (records, fields, links) {
toOneMap[field] = []

for (let record of records) {
const ids = Array.isArray(record[field]) ?
record[field] : [ record[field] ]
const value = record[field]
const ids = Array.isArray(value) ? value : value ? [ value ] : []

for (let id of ids)
if (!includes(toOneMap[field], id)) toOneMap[field].push(id)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "fortune",
"description": "High-level I/O for web applications.",
"version": "1.3.7",
"version": "1.3.8",
"license": "MIT",
"author": {
"email": "0x8890@airmail.cc",
Expand Down

0 comments on commit 22e7161

Please sign in to comment.