Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

anders.jornehag@sodra.com

It worked!

Thanks for your help Martin! The content-type was set when I turned off the suggested settings!
martin

Thanks. After some tests, it seems that the SSH_FXP_SETSTAT SFTP request clears the content type on Azure. It seems like a bug in Azure SFTP.

WinSCP uses that request to update the timestamp and/or permissions of the uploaded file.
So either something has changed on Azure side recently, or you had the "Preserve timestamp" (and "Set permissions") turned off before and now you have either of them on.
https://winscp.net/eng/docs/ui_transfer_custom

Turn both off. Or talk to Azure support.
anders.jornehag@sodra.com

Thanks for your answer Martin!
As I understand, the Azure Storage SFTP interface defaults content-type to application/octet-stream, and earlier the files we uploaded using WinSCP got the default-content-type but not anymore.

I wrote a C# console app using the Renci.SshNet-package, and when uploading files through this app, the content type was set to the default content type.

Attaching images of blob-properties using WinSCP and Renci.
using Renci.SshNet;
using System;
 
var host = "xxx.blob.core.windows.net";
var port = 22;
var username = "xxxx";
var password = "yyyy";
using var client = new SftpClient(host, port, username, password);
client.Connect();
 
var filePath = @"C:\file.xml";
 
FileStream fs = new(filePath, FileMode.Open);
 
client.UploadFile(fs, $"{Path.GetFileName(filePath)}");
martin

Re: Content-type not set when uploading file to Azure Storage

There's no Content-Type involved in SFTP protocol.
If you want to set the Content-Type, you have to use a different interface.
anders.jornehag@sodra.com

Content-type not set when uploading file to Azure Storage

Hi,

We use WinSCP to upload files to an SFTP-enabled Azure Storage Account.
We then use BizTalk to further process the file, but the BizTalk-adapter we use to get the file from the storage require the Content-Type to be set.

When we upload the file using WinSCP, this property is not set. I have tried different transfer modes, but it doesn't make any difference.

I also tried to upgrade to 6.3.3 and I have tried to look in the documentation with no success. Do you have any idea how to solve this?

Best regards,
Anders