UmbracoFileSystemProviders.Azure icon indicating copy to clipboard operation
UmbracoFileSystemProviders.Azure copied to clipboard

Uploading files through service APIs fails if you don't specify the exact filename

Open skttl opened this issue 8 years ago • 4 comments

If I upload a file on a property, while setting the filename to something thats not the right filename, then the upload fails (as in, the upload completes, but the file on the blob is 0 bytes. A _thumb file is created, with the right content.)

I'm doing this node.SetValue("umbracoFile", "mycustomfilename.jpg", myMemoryStream);

It works if I get the correct filename. In my example I have a file from a url, like node.SetValue("umbracoFile", fileNameFromUrl, myMemoryStream);

Thanks for a great package!

skttl avatar Feb 01 '17 10:02 skttl

Thanks @skttl :smile: What's the expected behavior? I.e. What does the standard media provider do?

JimBobSquarePants avatar Feb 01 '17 10:02 JimBobSquarePants

The standard media provider just uploads the file, and renames it to whatever you put in the filename parameter :)

skttl avatar Feb 01 '17 11:02 skttl

Ok, I'll investigate this. Thanks!

JimBobSquarePants avatar Feb 01 '17 11:02 JimBobSquarePants

@skttl I've been reading through my code and I'm not sure what I would need to do to ensure the behavior is the same.

Here's the Umbraco code for the default PhysicalFileSystem

https://github.com/umbraco/Umbraco-CMS/blob/f2c7c1e2c6a3e4dfa73ad1d1d5a1c01dd1779a56/src/Umbraco.Core/IO/PhysicalFileSystem.cs#L115

And here's what we are doing.

https://github.com/JimBobSquarePants/UmbracoFileSystemProviders.Azure/blob/3d5e3c5e0273b0710c2f9fc7cab4ad18a0d9d0a2/src/UmbracoFileSystemProviders.Azure/AzureFileSystem.cs#L221

Our code is a lot more verbose due to the increased moving parts but to me the logic appears to be the same.

JimBobSquarePants avatar Apr 15 '17 04:04 JimBobSquarePants