OokTech/TW5-Bob

Unexpected end of JSON input

s-kaczmarek opened this issue · 2 comments

I am running (check any that apply, put an x inside the [ ] to check a box, like this: [x]):

  • Windows
  • OSX
  • Linux
  • Other

and using

  • The nodejs version
  • The single file executable

Hi, today I have created new "sub wiki" by duplicating existing one from the bob settings and I have also renamed existing "sub wiki"

After that, renamed wiki appeared twice in the sub wikis list so I tried to refresh it and I also clicked on "unload" next to one of the doubled entries, which caused the server to crash with an error:

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Object.<anonymous> (/home/user/personal-wiki/index.js:106:21)
    at Module._compile (internal/modules/cjs/loader.js:936:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
    at Module.load (internal/modules/cjs/loader.js:790:32)
    at Function.Module._load (internal/modules/cjs/loader.js:703:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:999:10)
    at internal/main/run_main_module.js:17:11

Now I cannot start this server - same error appears when I try to rerun it. I don't understand what had broke, I don't recall any index.js file

ok, I figured it out myself - ../IndexWiki/settings.json file was wiped out. I restored it from settings backup and all looks good now. I haven't touched the file system, so it has to be a bug.

I think that this is related to a bug that I have run into a few times but I haven't been able to find what is causing it. It is something to do with unloading a wiki and then reloading it soon after, but I don't know where the problem is.

The wiki showing up twice in the list is a known bug that is purely a cosmetic display problem. If you have a wikis with names that start the same it can duplicate the longer one on the list. It doesn't do anything other than make the name appear on the list twice. Hopefully I will eventually update the display macro to keep that from happening but it is low priority.