0

I develop a logic app which should download a file from a remote location and store them in Share Point.

All files are png or gif files.

On the share point connector - upload file, I'm using binary(body('DOWNLOAD')) as input. However, the images are corrupt at Sharepoint.

Looked deeper it at, Logic App tries to parse the image as UTF-8 string which breaks the image.

Looking at hex level, the png looks different. test1x1.bad.png is the result at Sharepoint, test1x1.png is the original one.

$ xxd test1x1.bad.png | head -n 3
00000000: efbf bd50 4e47 0d0a 1a0a 0000 000d 4948  ...PNG........IH
00000010: 4452 0000 00ef bfbd 0000 00ef bfbd 0803  DR..............
00000020: 0000 00ef bfbd efbf bdef bfbd efbf bd00  ................
$ xxd test1x1.png | head -n 3
00000000: 8950 4e47 0d0a 1a0a 0000 000d 4948 4452  .PNG........IHDR
00000010: 0000 0080 0000 0080 0803 0000 00f4 e091  ................
00000020: f900 0002 7350 4c54 45ff ffff 3333 3333  ....sPLTE...3333

How I can avoid that Logic App parse the body as UTF-8 String?

I also tried body('DOWNLOAD') and base64ToBinary(body('DOWNLOAD')['$content']), but there is no difference. body('DOWNLOAD')['$content'] returns a base64 value of the image.

7
  • Where are you downloading the file from - SharePoint, SFTP, blob storage? What connector are you using to download the file? Commented Apr 8, 2024 at 18:08
  • Just upload it as it is from being downloaded. I doubt (could be wrong) that you’ll need to do any sort of conversion to binary. Commented Apr 8, 2024 at 20:14
  • @10p public http endpoint. I'm using the native http connector (learn.microsoft.com/en-us/azure/connectors/…) Commented Apr 8, 2024 at 20:18
  • @Skin Thanks for your comment. If it would work, I won't create a question here. Logic App modify the content, without asking for it. Commented Apr 8, 2024 at 20:18
  • Show us the response from the DOWNLOAD step then. Can you share the URL of the site you’re downloading the image from or is it not public? Commented Apr 8, 2024 at 20:20

1 Answer 1

0

body('DOWNLOAD') should work absolutely fine. Proof:

Downloading a Google logo from https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png -

HTTP - GET

Saving it to SharePoint:

SharePoint - Create file

Result:

PNG downloaded

PNG uploaded to SharePoint

SharePoint folder

File on SharePoint

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.