This project is read-only.
1
Vote

RetrCommandHandler - File is null issue

description

When a blob file doesn't have permissions to be accessed and the retr command tries to read the file, on line 37 of RetrCommandHandler.cs IFile file does not show up as null. Instead the file object exists, but file.File is null. The way the code is currently structured, instead of throwing an error, the file downloads, but no bytes are transferred. Below is my suggestion for changing the code to correctly throw an error. It's currently in use on my local version of the code.
 
Line 39: if (file == null || file.File == null)
 
This will solve the issue of empty files being downloaded as discussed in the discussion area. I've attached my copy of the file.

file attachments

comments

Kyry11 wrote Jun 19, 2012 at 5:40 AM

Thanks for this find, janiukjf :)

Saved me some time, looking around!

dbg00712 wrote Jun 26, 2012 at 3:12 PM

Hello janiukjf,
 
I managed to solve the problem, I implemented the method OpenFile class AzureFileSystem.

public IFile OpenFile(string sPath, bool fWrite)
    {
        sPath = PreparePath(sPath);
        AzureCloudFile file = _provider.Get(sPath, true);

        var f = new AzureFile();
        f.File = new System.IO.MemoryStream(file.Data);
        return f;
    }

dbg00712 wrote Jun 26, 2012 at 8:52 PM

I had a problem with posted code and corrected as follows:

public IFile OpenFile(string sPath, bool fWrite)
{
       sPath = PreparePath(sPath);
        AzureCloudFile file = _provider.Get(sPath, true);

        var f = new AzureFile();
        if (file != null)
        {
            f.File = new System.IO.MemoryStream(file.Data);
        }
        return f;
}

wrote Feb 14, 2013 at 8:06 PM