-
Notifications
You must be signed in to change notification settings - Fork 5
Bug: unescaped special characters in visible project name cause kobweb run to config error #14
Description
It's not that critical, but I wanted to report it.
While setting up the project with kobweb create, it allows to pass any kind of character to the visible name of the project:
$ kobweb create app/empty
...
? What is the user-visible display title for your project?
> Foo's "Bar\Baz"
...However, the config is stored in YAML, and it does not allow unescaped quotes and backslashes, leading to a config error when running the app via kobweb run:
$ kobweb run -p foobar/site
✗ A .kobweb folder's `conf.yaml` file seems to have been deleted at some point. This is not expected and Kobweb cannot run without it. Consider restoring your `conf.yaml` file from source control history if possible, or create a new, temporary Kobweb project from scratch and copy its `conf.yaml` file over, modifying it as necessary.(BTW, the message confused me the first time, and I thought it was a problem with my Linux distribution, but it's not)
So, what causes such issue?
Currently, the code that checks config validity, is just a null check on config content:
kobweb-cli/kobweb/src/main/kotlin/com/varabyte/kobweb/cli/common/KobwebUtils.kt
Lines 52 to 55 in 0f68aec
| fun assertKobwebConfIn(kobwebFolder: KobwebFolder): KobwebConf { | |
| return KobwebConfFile(kobwebFolder).content | |
| ?: throw KobwebException("A .kobweb folder's `conf.yaml` file seems to have been deleted at some point. This is not expected and Kobweb cannot run without it. Consider restoring your `conf.yaml` file from source control history if possible, or create a new, temporary Kobweb project from scratch and copy its `conf.yaml` file over, modifying it as necessary.") | |
| } |
Which was always null on any parse error. I did a quick check, and it seems to lead to a non-strict YAML parser (not really sure):
A possible solution would be to automatically escape all special symbols and show the user a small warning so they don't try it next time.