Skip to content

Issue: Data file is not created if it does not exist #621

Description

@davidsneighbour

Describe the bug
With a new data file configuration there is no error message when I add a new item, but the data file is also not created if it does not exists. The config in .frontmatter/config/data/files/kurzschnitte.json is as follows:

{
  "$schema": "https://frontmatter.codes/config/data.files.schema.json",
	"id": "kurzschnitte",
	"title": "Kurzschnitte",
	"file": "[[workspace]]/data/dnb/kollitsch/kurzschnitte.json",
	"fileType": "json",
	"labelField": "title",
	"singleEntry": false,
	"schema": {
		"title": "Kurzschnitte",
		"type": "object",
		"required": [
			"title",
			"link",
			"slug"
		],
		"properties": {
			"title": {
				"type": "string",
				"title": "Title"
			},
			"link": {
				"type": "string",
				"title": "Link"
			},
			"description": {
				"type": "string",
				"multiline": true,
				"title": "Description"
			},
			"labels": {
				"type": "array",
				"items": {
					"type": "string"
				}
			},
			"slug": {
				"type": "string",
				"title": "Kurzschnitt-Post"
			},
		}
	}
}

Adding a new entry on the Dashboard > Data screen -

  1. If the file [[workspace]]/data/dnb/kollitsch/kurzschnitte.json does not exist then Frontmatter shows a success message but does not add the item in the items column, and also no data file in the configured location

  2. If I create a file in [[workspace]]/data/dnb/kollitsch/kurzschnitte.json with an empty JSON content ({}) then it works as expected.

I would expect Frontmatter to have enough rights to create the file (file rights on the folder are checked and belong to the user opening VSCode) or at least fail or convey the failing properly.

Desktop (please complete the following information):

  • OS: Ubuntu 22.04 LTS
  • Browser: Chrome latest

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions