none
Coerce ftp Content-Type RRS feed

  • Question

  • Hi,

    When reading the content of an ftp location using the ftp GetContent (by path) connector, if the file does not have an extension, the logic app is returning the body.$content as a base64 string with a $content-type = application/octet-stream.

    Is there a way to coerce GetContent to force it to return a text/plain string?

    Results of GetContent - Case 1 - without file extension, Case 2 with.

    Regards,

    Stuart

    Case 1

    Get file content
    Inputs
    File
    /in/new/K365-152-20170822-11402499

    Outputs
    File Content
    {
      "$content-type": "application/octet-stream",
      "$content": "SHxHUkJILTAxNzU2N3wyMi1BdWctMjAxN3wxMTo0MDoyNHxLMzY1LTE1Mn...OS45OXx8MTE5Ljk5fDEwLjkx"
    }

    Case 2.

    Get file content
    Inputs
    File
    /in/new/K365-152-20170822-11402499.txt

    Outputs
    File Content
    H|GRBH-017567|22-Aug-2017|11:40:24|K365-152|359.97|32.72|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|||||||||||0.00|||||||testing|||
    L|PCP-1021281|Baccarat Le Connoisseur Grill |1|119.99||119.99|10.91
    L|PCP-1021281|Baccarat Le Connoisseur Grill |1|119.99||119.99|10.91
    L|PCP-1021281|Baccarat Le Connoisseur Grill |1|119.99||119.99|10.91




    • Edited by Stuboy Wednesday, August 23, 2017 12:29 AM
    Wednesday, August 23, 2017 12:18 AM

All replies

  • Hi,

    what do you mean by a file with no extension??

    In my opinion rather than fixing the problem in the LA, the file that has been put into the FTP folder should have only the correct extensions. Saves a lot of time and effort than handling this in code.


    Mandar Dharmadhikari

    Wednesday, August 23, 2017 3:51 AM
  • Just curious, does setting the transfer mode Ascii change anything?

    In Logic App terms: Binary Transport = false

    I have not been using the FTP adapter that much so I am just suggesting.


    //Mikael Sand - Enfo Sweden If you find any post helpful, please mark it as such. If I answer your question, humor me with a thank you or mark as answer.

    Wednesday, August 23, 2017 6:30 AM
  • Hi Mandar, the file name is generated by a third party and I would like to see if there's an alternative resolution before either asking them to rename the files. I could also rename the files on the fly but I wanted to see if there was another way.
    Wednesday, August 23, 2017 8:49 PM
  • Hi Mikael,I have tried setting and unsetting the binary checkbox and it doesn't make a difference in this case.

    Wednesday, August 23, 2017 8:54 PM
  • If you click the link for show Advanced Options there is an option for "Infer content type", and then you can choose a custom value, and specify the content type you want it to use like your text/plain one. 

    Thanks,


    If this answers your question, please use the "Answer" button to say so | Ben Cline

    Wednesday, August 23, 2017 9:05 PM
  • Hi Ben, sorry for the late reply. The "Infer Content Type" doesn't allow me to enter a string value - only the result of a boolean expression. Thanks.
    Sunday, August 27, 2017 11:47 PM