mirror of
https://github.com/moghtech/komodo.git
synced 2026-05-06 08:55:40 -05:00
[GH-ISSUE #247] [Bug] Resource Sync not escaping backslashes on commit #5942
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Copper9564 on GitHub (Jan 5, 2025).
Original GitHub issue: https://github.com/moghtech/komodo/issues/247
Hello!
After adding a stack containing a backslash in a service's command (
'-allowGET=/v1\..{2}/(containers/.*|events|info)|/_ping') and committing to my git server, Komodo can no longer syncKomodo isn't escaping the backslash before committing, then gets stuck trying to parse it back in since it's not escaped properly.
If I manually escape it on the git server then the issue goes away on Komodo's side.
@mbecker20 commented on GitHub (Jan 6, 2025):
Can you clarify the difference in how you committed this change? Are you saying in the first case, you committed the change through the Komodo UI, while in the second, it was committed through manual editor (like VSCode) + command line commit?
@Copper9564 commented on GitHub (Jan 6, 2025):
I'm primarily using the resource sync one-way only from Komodo --> Gitea, but I think most people are defining resources from Git --> Komodo. So here's a clearer example to help replicate:
Set up a resource sync with git (Gitea in my case). Set managed mode to enable commits from KomodoUI.
Add this UI defined stack which contains a backslash via KomodoUI:
Commit changes to git

Notice the commit action is successful, but now the resource sync status immediately says FAILED. Info tab shows the escape sequence error:

View the committed toml file (either directly on Gitea or with an editor like VSCode), and notice the backslash is unescaped which would prevent the toml from being parsed back into Komodo:
I'm not too familiar with TOML, but was also able to get it working by using the multi-line literal
'''instead of""", but then you lose the ability to actually escape things if needed. I'd guess the right way to address this is to scan for and escape backslashes when writing the TOML file(s) to be committed.Hope that makes better sense. Thanks for your work on this project, and fantastic job thus far!
@mbecker20 commented on GitHub (Jan 6, 2025):
Thanks so much for the detailed description, yes I can reproduce this and it is a tricky bug.
@june012006 commented on GitHub (Jan 27, 2025):
It also will not remove the escape backslashes syncing back to komodo. Which means we can't use resource sync for anything that requires toml special characters, such as the normal traefik host label (backticks)
Here is an example from my gitea stored toml, with only my domain stripped
and the resulting compose file for the stack
Fortunately, I only executed the sync on this one, which is only for troubleshooting
@mbecker20 commented on GitHub (Aug 26, 2025):
There were changes here, is this still and issue?
@Copper9564 commented on GitHub (Aug 26, 2025):
Ah, sorry 😅 - yes everything works as expected now. Thanks for all your work!