-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: unescaped special characters in visible project name cause kobweb run
to config error
#14
Comments
Thank you for reporting and sorry I missed this issue for so long. I'll take a look at it for the next release. |
It turns out that if a conf.yaml file cannot be parsed, we were interpreting that as the file not existing, which caused us to deliver a confusing error message. Now, we distinguish between the two cases and issue an appropriate error based on whether the file was deleted or just not parsable. Bug #14
... which can be useful when importing user strings in conf.yaml files, etc. Bug #14
Hello! It has been a while but finally had some time to work on the Kobweb CLI for a bit. Two points of good news in relation to this issue...
So, the slightly bad news..... The YAML escaping method will only be available to users using 0.9.17 (which, at the moment, I'm aiming to release on Monday or Tuesday of next week). So even though in theory I can insert the method into the kobweb template to fix this issue after that point, I would need to bump the minimum version of the app template to 0.9.17 as well. If it was some random example template that had the issue, I would just go ahead and do this. However, the |
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: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
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):https://github.com/varabyte/kobweb/blob/17e25243da037a2c3373cca33969ea97175974a4/common/kobweb-common/src/main/kotlin/com/varabyte/kobweb/project/conf/KobwebConf.kt#L233-L237
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.
The text was updated successfully, but these errors were encountered: