Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transforming directory pathh adds extra slashes "\\" #78

Open
sunilbindra opened this issue Sep 13, 2018 · 3 comments · May be fixed by #133
Open

Transforming directory pathh adds extra slashes "\\" #78

sunilbindra opened this issue Sep 13, 2018 · 3 comments · May be fixed by #133

Comments

@sunilbindra
Copy link

sunilbindra commented Sep 13, 2018

I am suing Magic chunks. In my master json file I have one key with value

"ExternalFiles": {
"EncryptionKeyFile": "C:\TotalKeys\key.config.json"
}
In my transformation file transforming it to I have this

"ExternalFiles/EncryptionKeyFile": "C:\TotalKeys\keytest.config.json"

When it transform result is having some extra slashes, dont know why:-

"ExternalFiles": {

image

}

Any Idea why there are extra "\". it got 4 instead of 2.

Any one aware of any solution
Thanks

@sourcejon
Copy link

bump

@nils-a
Copy link
Contributor

nils-a commented Oct 4, 2021

@sourcejon, @sunilbindra I wanted to have a look at this, but could not reproduce it.
Would one of you be in a position to provide a minimal example that reproduces the error?

@nils-a
Copy link
Contributor

nils-a commented Oct 4, 2021

Found it. This happens, when using the DevOps Task and "correctly" escaping \ in json of the transformation.

I.e. when the task is defined like:

- task: MagicChunks@2
  inputs:
    sourcePath: 'test.json'
    fileType: 'Auto'
    targetPathType: 'source'
    transformationType: 'json'
    transformations: |
      {
        "ExternalFiles/EncryptionKeyFile": 
              "C:\\TotalKeys\\keytest.config.json"
      }

(notice the double \\ in the transformations) - the error occurs.

However, if the transformation-json is defined ("wrongly") as

- task: MagicChunks@2
  inputs:
    sourcePath: 'test.json'
    fileType: 'Auto'
    targetPathType: 'source'
    transformationType: 'json'
    transformations: |
      {
        "ExternalFiles/EncryptionKeyFile": 
              "C:\TotalKeys\keytest.config.json"
      }

(notice the single \ in the transformations) - the error does not occur.

This behavior is the same, regardless whether one is using the "Inline JSON" transformation type or the "JSON File" type.

nils-a added a commit to nils-a/magic-chunks-dotnetcore that referenced this issue Oct 4, 2021
When parsing the input for the DevOps task, every occurrence
of "\" was replaced by "\\" - probably in the assumption that
every JSON specified as transformation will always be
incorrectly escaped.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants