Vinzent03/obsidian-advanced-uri

data.json malformed with preceding `gi`

replete opened this issue · 2 comments

I've noticed a console error in Obsidian recently, and after stepping through a debugger, found the cause was an obsidian app readJson method failing to parse some JSON from this plugin's data.json.

Screenshot 2024-03-24 at 13 08 18

data.json:

gi{
  "openFileOnWrite": true,
  "openDailyInNewPane": false,
  "openFileOnWriteInNewPane": false,
  "openFileWithoutWriteInNewPane": false,
  "idField": "id",
  "useUID": false,
  "addFilepathWhenUsingUID": false,
  "allowEval": false
}

I've no idea what caused this, but my guess from seeing 'gi' is a regex kind of bug? Removing the erroneous gi fixed my javascript error. Just wanted to flag this up, if it happens again I'll come back to this ticket

Thanks for this plugin. It's a go-to feature for me and allows me to deeply integrate with my OS, automating lots of stuff.

I highly doubt this is caused by this plugin, as I'm using the same method as every other plugin to serialize a javascript object (which for sure doesn't contain that prefix), which is then stored by the Obsidian api to the data.json file. The issue must be caused somewhere else.

I looked through your source code after I posted this and came to the same conclusion, though I forgot to reply. I'll close this now. I can only think that it is some weird side-effect of something else that only affects this plugin, and I think to do with it being the first plugin to load in Obsidian.

I'll close this for now as there's no action, but logging it seemed worth it. Thanks!