micromata / dave

A totally simple and very easy to configure stand alone webdav server
Apache License 2.0
350 stars 46 forks source link

"Fatal error config file: While parsing config: yaml: line [nn]: did not find expected hexdecimal number" #31

Closed boegh closed 3 years ago

boegh commented 3 years ago

I am trying to use the standalone binary on a Windows 10 host. However with config.yaml that is made directly from config-sample.yaml except for a change of the dir-directive I get the following error when launching dave:

C:\Users\user\Downloads\dave-0.4.0-windows-amd64>dave time="2021-07-04T17:14:02+02:00" level=fatal msg="Fatal error config file: While parsing config: yaml: line 26: did not find expected hexdecimal number"

C:\Users\user\Downloads\dave-0.4.0-windows-amd64>

The line number (26) is the dir-directive

I have tried with the following two dir-directive, where I have tried the following two:

dir: "c:\Users\user\Downloads"

and

dir: "c:\\\Users\\\user\\\Downloads"

I can't find anything in the documentation, that might indicate, that it should be written otherwise :(

Moving the line with the dir around, makes the error change to that line, so I am certain it is related to dir...

boegh commented 3 years ago

After having played a bit around, the issue seems to be two-fold (but solved):

  1. \U, \\\U, \u and \\\u makes golang expect a eight or four character unicode, which is why it expects a hexadecimal number.
  2. Tripple-backlashes creates all sorts of crazy. I.e. Trying with c:\\\Lsers results in level=info msg="Created base dir" path="d:\\\u2028sers" (and in the end just a directory named sers). Exactly two backlashes in paths is the right number.
divinity76 commented 1 year ago

@bogeh another solution is to use single-quote ' instead of " for example

dir: 'c:\Users\user\Downloads'

works the same as

dir: "c:\\Users\\user\\Downloads"