2
0
Fork
You've already forked cms
0

fix: Malformed JSON (Don't parse empty JSON files) #64

Merged
kylesloper merged 1 commit from fix/malformed-json into main 2025年07月18日 23:49:17 +02:00
kylesloper commented 2025年07月18日 19:24:00 +02:00 (Migrated from github.com)
Copy link

Before: When creating a file, the CMS would first fetch and read it. Then it would parse it with the JSON transformer if using JSON If the file didn't exist, it would try and parse nothing which always returned an error.

Error always returned from create document:

Malformed JSON code: Unexpected end of JSON input...

Now: Checks if the content passed to the JSON transformer is empty. If so then do not parse and return an empty object {}

Before: When creating a file, the CMS would first fetch and read it. Then it would parse it with the JSON transformer if using JSON If the file didn't exist, it would try and parse nothing which always returned an error. Error always returned from create document: ``` Malformed JSON code: Unexpected end of JSON input... ``` Now: Checks if the content passed to the JSON transformer is empty. If so then do not parse and return an empty object `{}`

Thanks!

Thanks!
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lume/cms!64
Reference in a new issue
lume/cms
No description provided.
Delete branch "fix/malformed-json"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?