compose icon indicating copy to clipboard operation
compose copied to clipboard

Fix docker-compose convert that turns $ into $$ when using the --no-interpolate option

Open BergLucas opened this issue 3 years ago • 0 comments

What I did I checked the Python implementation of the interpolation feature in v1 and found out that the serialize_config function in the compose.config.serialize module was only escaping the $ when the --no-interpolate option was not enabled.

In the current implementation, which was partially modified by #8632, the Convert function always escapes the $ and therefore does not work the same way as in v1. It should first check if the --no-interpolate option was enabled or not.

However, this was not possible in the Convert function, because there were no parameters giving this information and the function was hidden under the Service interface, so it would have been difficult to change it. That's why I moved the code responsible for escaping the $ out of the Convert function and checked the value of the --no-interpolate option before calling it. By doing so, the bug is fixed and it works as in v1.

Related issues fixes #9160 improves #8632

(not mandatory) A picture of a cute animal, if possible in relation with what you did IMG_20200407_162414

This is my first pull request and my first experience with go, so sorry if I did something wrong.

BergLucas avatar Aug 02 '22 01:08 BergLucas