Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

buildArgs encoding is converting spaces to + #136

Closed
ncouse opened this issue Feb 5, 2018 · 10 comments · May be fixed by #350
Closed

buildArgs encoding is converting spaces to + #136

ncouse opened this issue Feb 5, 2018 · 10 comments · May be fixed by #350
Labels

Comments

@ncouse
Copy link

ncouse commented Feb 5, 2018

If I have spaces in my build arguments, they get converted to + symbols.

For example if I can add configuration like this:

<configuration>
	<buildArgs>
		<SOME_ARG>hello world</SOME_ARG>
	</buildArgs>
</configuration>

When I actually use that argument in a Dockerfile is will look like

hello+world
@ncouse
Copy link
Author

ncouse commented Feb 5, 2018

The problem seems to be in the BuilderMojo code:

        final String encodedBuildArgs = URLEncoder.encode(new Gson().toJson(buildArgs), "utf-8");
        buildParameters.add(new DockerClient.BuildParam("buildargs", encodedBuildArgs));

The JSON conversion works properly, and it gets converted to {"SOME_ARG":"hello world"}
However the URL Encoding of this is where the problem would appear to lie, and it gets converted to %7B%22SOME_ARG%22%3A%22hello+world%22%7D

Note that spaces in build arguments is supported by Docker, and I have several use cases where we would need spaces in arguments.

@delfuego
Copy link

I too am hitting this; my entire build server directory structure has spaces in the project directory names.

Any chance of this being fixed?

@stale
Copy link

stale bot commented Sep 24, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 24, 2018
@ncouse
Copy link
Author

ncouse commented Sep 24, 2018

Bumping this to stop the stale bot. This issue is problematic. Have worked around it for now, but prevents me using it properly.

@stale stale bot removed the stale label Sep 24, 2018
@stale
Copy link

stale bot commented Nov 23, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 23, 2018
@ncouse
Copy link
Author

ncouse commented Nov 23, 2018

Bump.

@stale stale bot removed the stale label Nov 23, 2018
@stale
Copy link

stale bot commented Jan 28, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 28, 2019
@stale stale bot closed this as completed Feb 5, 2019
@jrmcdonald
Copy link

I am also running into this issue when using build args to set descriptive labels in containers.

@ncouse Out of curiosity, how did you work around this?

@thibgc
Copy link

thibgc commented Apr 11, 2019

We are having the same issue, but this issue has been closed by the stale bot.

@thibgc
Copy link

thibgc commented Apr 11, 2019

@ncouse @delfuego @jrmcdonald This issue is closed so new comments probably won't go anywhere. I've re-opened a brand new issue, #286 -- please go there and comment.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants