Fixing LastUpdatedTime fetch on azure

This commit is contained in:
Sebastien Ros
2014-03-03 11:29:38 -08:00
parent d86a63a559
commit 178dc94555
2 changed files with 1 additions and 4 deletions

View File

@@ -287,8 +287,6 @@ namespace Orchard.Azure.Services.FileSystems {
public string GetPublicUrl(string path) { public string GetPublicUrl(string path) {
path = ConvertToRelativeUriPath(path); path = ConvertToRelativeUriPath(path);
Container.EnsureBlobExists(String.Concat(_root, path));
return Container.GetBlockBlobReference(String.Concat(_root, path)).Uri.ToString(); return Container.GetBlockBlobReference(String.Concat(_root, path)).Uri.ToString();
} }
@@ -314,6 +312,7 @@ namespace Orchard.Azure.Services.FileSystems {
} }
public DateTime GetLastUpdated() { public DateTime GetLastUpdated() {
_blob.FetchAttributes();
return _blob.Properties.LastModified.GetValueOrDefault().DateTime; return _blob.Properties.LastModified.GetValueOrDefault().DateTime;
} }
@@ -335,7 +334,6 @@ namespace Orchard.Azure.Services.FileSystems {
_blob.DeleteIfExists(); _blob.DeleteIfExists();
_blob = _blob.Container.GetBlockBlobReference(_blob.Uri.ToString()); _blob = _blob.Container.GetBlockBlobReference(_blob.Uri.ToString());
_blob.UploadFromStream(new MemoryStream(new byte[0])); _blob.UploadFromStream(new MemoryStream(new byte[0]));
return OpenWrite(); return OpenWrite();
} }
} }

View File

@@ -1,6 +1,5 @@
using System; using System;
using System.Linq; using System.Linq;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob; using Microsoft.WindowsAzure.Storage.Blob;
namespace Orchard.Azure.Services.FileSystems { namespace Orchard.Azure.Services.FileSystems {