Skip to content

MAINTAINER to LABEL conversion does not escape embedded quotes #70

Closed

Description

@gaborbernat

Rewriting MAINTAINER into LABEL org.opencontainers.image.authors="..." wraps the value in double quotes without escaping the quotes it already contains.

Reproduce

FROM alpine
MAINTAINER Jane Doe "jane@example.com"
dockerfmt Dockerfile

Actual

FROM alpine
LABEL org.opencontainers.image.authors="Jane Doe "jane@example.com"

The quotes no longer pair up, and docker build fails on the output:

failed to process "\"Jane Doe \"jane@example.com\"": unexpected end of statement while looking for matching double-quote

Expected

Escape embedded quotes:

LABEL org.opencontainers.image.authors="Jane Doe \"jane@example.com\""

Leaving MAINTAINER unchanged when the value contains a quote would also work.

Impact

With --write the Dockerfile no longer builds. One of the three MAINTAINER lines in a sample of about 450 real-world Dockerfiles had quotes in its value.

Reproduced with v0.5.4 and with main at a5868c2.

Activity

  1. RyoKusnadi commented on Nov 5, 2026

    @RyoKusnadi
    Contributor

    @reteps I opened #75 for this. Could you please review it when you have a moment? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions