exocortex icon indicating copy to clipboard operation
exocortex copied to clipboard

Windows paths are not escaped correctly

Open trytriangles opened this issue 7 years ago • 6 comments

Windows paths use \ as the separator. When Exocortex writes its config file, it doesn't properly escape those slashes, meaning that when the config gets parsed each separator is interpreted as an attempt at writing an escape character, which always results in a fatal error.

C:\Users\Ryan > exo new test
   • Creating your new wiki: test
   • Successfully created your wiki: cd C:\Users\Ryan\test && exo start

C:\Users\Ryan > cd test && exo start
    ⨯ exo: Config file required to start wiki: While parsing config: invalid character 'U' in string escape code

trytriangles avatar Jan 08 '18 07:01 trytriangles

Whoops! Thanks for filing, I'll get a fix in soon

SpencerCDixon avatar Jan 08 '18 11:01 SpencerCDixon

Hmmm seems like I'm using filepath.Join in most places... @ryantriangles is it just failing to create the exocortex.json file in your test dir? If it did create one can you paste me the contents?

SpencerCDixon avatar Jan 08 '18 11:01 SpencerCDixon

I have the same issue, no problems creating the exocortext.json file. Exact same error message.

Exo starts if I edit the json file to escape the paths manually.

kempjeng avatar Jan 08 '18 11:01 kempjeng

Could either of you paste me your .json file? So sounds like it's the repository field that is incorrect?

SpencerCDixon avatar Jan 08 '18 13:01 SpencerCDixon

It successfully creates one, it's just writing a Windows path as-is. The error is helpfully highlighted by GitHub's JSON highlighting.

{
  "server": {
    "host": "localhost",
    "port": 1234
  },
  "repository": "D:\temp\hello",
  "syncInterval": 30,
  "title": "My Wiki",
  "remote": "origin",
  "branch": "master"
}

trytriangles avatar Jan 08 '18 17:01 trytriangles

#18 is intended to fix this issue.

shonlove avatar Nov 08 '18 18:11 shonlove