Skip to content

JSON report on windows not escaping file path #817

Closed

Description

@henryborchers

The json report generated by mediaconch does not escape the file path backslashes for Windows file paths in MediaConch.media.ref field which results in malformed formatted json on Windows.

MediaConch.exe dummy\bars.mp4 --Output-Json=dummy.json will generate the following json


{
  "MediaConch": {
    "version": "0.2",
    "verbosity": 5,
    "creatingApplication": {
      "name": "MediaConch",
      "version": "25.04",
      "url": "https://mediaarea.net/MediaConch"
    },
    "media": [
      {
        "ref": "dummy\bars.mp4",
        "implementationChecks": [
          {
            "pass_count": 0,
            "info_count": 0,
            "warn_count": 0,
            "fail_count": 0,
            "checks_run": 0,
            "name": "MediaConch Implementation Checker does not support AVC as found in Video track"
          }
        ]
      }
    ]
  }
}


"ref": "dummy\bars.mp4", does not escape the backslash. JSON reads \b in the filename as an escape character instead of a backslash.
Since Windows uses backslashes for paths, this is only a problem on Windows machines. This should either escape the backslash character with a second backslash or the ref field should use the unix style paths aka forward slash.

I have tested this on both 25.04 and on latest commit.

Activity

  1. henryborchers commented on Jun 8, 2026

    @henryborchers
    ContributorAuthor

    on windows. "ref": "dummy\bars.mp4" should be "ref": "dummy\\bars.mp4". In fact any value with a backslash when serialized as json should be escaped with a double backslash.

  2. henryborchers commented on Jun 9, 2026

    @henryborchers
    ContributorAuthor

    @JeromeMartinez any objection to me adding a test suite for MediaConch to catch runtime error like this?

  3. JeromeMartinez commented on Jun 9, 2026

    @JeromeMartinez
    Member

    @JeromeMartinez any objection to me adding a test suite for MediaConch to catch runtime error like this?

    We are definitely late on test suites, something we should do at some point.

  4. henryborchers commented on Jun 10, 2026

    @henryborchers
    ContributorAuthor

    If you are okay with using Catch2 testing framework, I'm willing to get a test suite started for you.

  5. henryborchers commented on Jun 10, 2026

    @henryborchers
    ContributorAuthor

    Created a PR that updates ‎Source/Resource/displays/MediaConchJson.xsl to correctly escape the ref value. However, this file seems to an input for a generation step to create Source/Common/generated/ImplementationReportDisplayJsonXsl.h. What are you doing here to generate it as a constant?

  6. g-maxime commented on Jun 10, 2026

    @g-maxime
    Contributor

    We just convert the file into a C-style array with this tool

    Already done for your PR.

  7. henryborchers commented on Jun 10, 2026

    @henryborchers
    ContributorAuthor

    @g-maxime Thanks.

    Looks like something I did broke the build. I'm not exactly sure why though.

  8. henryborchers commented on Jun 10, 2026

    @henryborchers
    ContributorAuthor

    Looks like it wasn't building even before I made my changes....

  9. JeromeMartinez commented on Jun 11, 2026

    @JeromeMartinez
    Member

    If you are okay with using Catch2 testing framework, I'm willing to get a test suite started for you.

    I tend to prefer gtest because I already worked with it in the past, but well... The person who does the job is permitted to choose the framework (within limits of complexity and being well known... Catch2 is acceptable).

  10. henryborchers commented on Jun 15, 2026

    @henryborchers
    ContributorAuthor

    Fix in #820 and #818

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions