0

There is a Pushes client in Azure DevOps REST API that allows to create pushes with new commits. I followed examples provided in here however there isn't one where a file encoding is to be changed. I tried to provide the necessary encoding in a request payload as follows:

  "refUpdates": [{ "name": "refs/heads/master", "oldObjectId": "..." }],
    "commits": [{
      "comment": "Comment",
      "changes": [{
        "changeType": 2, // also tried type "4" which stands for "Encoding"
        "item": {
          "path": "...",
          "contentMetadata": { "encoding": 1252 } // UTF-8
        },
        "newContent": { content: "New content", contentType: 0 },
      }]
    }]

but it doesn't do anything, "contentMetadata" field seems to be ignored by the Pushes client.

Is there a way to change a file encoding using Azure DevOps REST API?

sayan saha
  • 91
  • 2
  • 8
Nick
  • 1
  • 1

1 Answers1

0

I can reproduced the same issue. The contentMetadata field got ignored and the file encoding failed to be updated.

You can report this issue to Microsoft development team in the Developer Community website. Hope they will look into this issue and provide a fix.

Levi Lu-MSFT
  • 27,483
  • 2
  • 31
  • 43