Skip to content

Commit

Permalink
Merge branch 'develop-version-3' into main-version-3
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeavon committed Sep 22, 2021
2 parents c8b73e3 + 3549e61 commit d373e2a
Show file tree
Hide file tree
Showing 8 changed files with 141 additions and 144 deletions.
52 changes: 10 additions & 42 deletions appveyor.yml
@@ -1,4 +1,4 @@
version: 3.0.0.{build}
version: 3.0.1.{build}

os: Visual Studio 2019

Expand All @@ -9,7 +9,7 @@ configuration: Release

environment:
# Version Suffix
version_suffix: beta3
version_suffix: alpha

install:
- ps: .\build\appveyor-semver.ps1
Expand All @@ -23,12 +23,12 @@ install:
node appveyor-nuspec-patch.js
cd..
- ps: >-
$msiPath = "$($env:USERPROFILE)\MicrosoftAzureStorageEmulator.msi"
#- ps: >-
# $msiPath = "$($env:USERPROFILE)\MicrosoftAzureStorageEmulator.msi"

(New-Object Net.WebClient).DownloadFile('https://download.microsoft.com/download/F/3/8/F3857A38-D344-43B4-8E5B-2D03489909B9/MicrosoftAzureStorageEmulator.msi', $msiPath)
# (New-Object Net.WebClient).DownloadFile('https://download.microsoft.com/download/F/3/8/F3857A38-D344-43B4-8E5B-2D03489909B9/MicrosoftAzureStorageEmulator.msi', $msiPath)

cmd /c start /wait msiexec /i $msiPath /quiet
# cmd /c start /wait msiexec /i $msiPath /quiet

assembly_info:
patch: true
Expand All @@ -44,9 +44,10 @@ build_script:
cd..
before_test:
- cmd: '"%programfiles(x86)%\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe" start'
# Turn tests off just now
test: on
- cmd: >-
npm install -g azurite
- ps: >-
Start-Process azurite-blob.cmd -PassThru
artifacts:
- path: artifacts\*.nupkg
Expand All @@ -63,17 +64,6 @@ deploy:
on:
branch: develop-version-3

# GitHub Deployment for releases -v3
- provider: GitHub
auth_token:
secure: Kucu1gQQf8bjRlkR72fyZUiUtmkz7rtZEIgK/RMT1pMnq700m5sSQTiFHOSQUdR5
artifact: /.*\.zip/ # upload all Zip packages to release assets
draft: false
prerelease: false
on:
branch: main-version-3
appveyor_repo_tag: true # deploy on tag push only

# NuGet Deployment for releases - v3
- provider: NuGet
server:
Expand All @@ -94,17 +84,6 @@ deploy:
on:
branch: develop-version-2

# GitHub Deployment for releases -v2
- provider: GitHub
auth_token:
secure: Kucu1gQQf8bjRlkR72fyZUiUtmkz7rtZEIgK/RMT1pMnq700m5sSQTiFHOSQUdR5
artifact: /.*\.zip/ # upload all Zip packages to release assets
draft: false
prerelease: false
on:
branch: master-version-2
appveyor_repo_tag: true # deploy on tag push only

# NuGet Deployment for releases - v2
- provider: NuGet
server:
Expand All @@ -125,17 +104,6 @@ deploy:
on:
branch: develop-version-1

# GitHub Deployment for releases -v1
- provider: GitHub
auth_token:
secure: Kucu1gQQf8bjRlkR72fyZUiUtmkz7rtZEIgK/RMT1pMnq700m5sSQTiFHOSQUdR5
artifact: /.*\.zip/ # upload all Zip packages to release assets
draft: false
prerelease: false
on:
branch: main-version-1
appveyor_repo_tag: true # deploy on tag push only

# NuGet Deployment for releases - v1
- provider: NuGet
server:
Expand Down
2 changes: 1 addition & 1 deletion build/UmbracoFileSystemProviders.Azure.Media.proj
Expand Up @@ -88,7 +88,7 @@
<!-- Umbraco specific -->
<!-- Newtonsoft.Json Excluded for now as Umbraco requires different major versions -->
<CoreBinFiles Include="$(CoreProjectDir)\bin\$(BuildConfig)\Our.Umbraco.FileSystemProviders.Azure.dll" />
<UmbracoOtherBinFiles Include="$(InstallerProjectDir)\bin\$(BuildConfig)\Microsoft.Web.XmlTransform.dll;$(CoreProjectDir)\bin\$(BuildConfig)\Azure.Storage.Blobs.dll;$(CoreProjectDir)\bin\$(BuildConfig)\Azure.Storage.Common.dll;$(CoreProjectDir)\bin\$(BuildConfig)\Azure.Core.dll;$(CoreProjectDir)\bin\$(BuildConfig)\System.Memory.Data.dll;$(CoreProjectDir)\bin\$(BuildConfig)\System.Text.Encodings.Web.dll;$(CoreProjectDir)\bin\$(BuildConfig)\System.Text.Json.dll" />
<UmbracoOtherBinFiles Include="$(InstallerProjectDir)\bin\$(BuildConfig)\Microsoft.Web.XmlTransform.dll;$(CoreProjectDir)\bin\$(BuildConfig)\Azure.Storage.Blobs.dll;$(CoreProjectDir)\bin\$(BuildConfig)\Azure.Storage.Common.dll;$(CoreProjectDir)\bin\$(BuildConfig)\Azure.Core.dll;$(CoreProjectDir)\bin\$(BuildConfig)\System.Memory.Data.dll;$(CoreProjectDir)\bin\$(BuildConfig)\System.Text.Encodings.Web.dll;$(CoreProjectDir)\bin\$(BuildConfig)\System.Text.Json.dll;$(CoreProjectDir)\bin\$(BuildConfig)\System.Diagnostics.DiagnosticSource.dll" />
<InstallerBinFiles Include="$(InstallerProjectDir)\bin\$(BuildConfig)\Our.Umbraco.FileSystemProviders.Azure.Installer.dll" />
<UmbracoInstallerFiles Include="$(InstallerProjectDir)\Configurator\**\*.*"/>
<UmbracoInstallerLogo Include="$(MSBuildProjectDirectory)\assets\logo\azure-logo-32.png"/>
Expand Down
4 changes: 2 additions & 2 deletions build/appveyor-nuspec-patch.js
Expand Up @@ -5,8 +5,8 @@ function updateDependency(fileName) {
var read = require('read-file');
var buffer = read.sync(fileName, { encoding: 'utf8' });

var DomParser = require('xmldom').DOMParser;
var XmlSerializer = require('xmldom').XMLSerializer;
var DomParser = require('@xmldom/xmldom').DOMParser;
var XmlSerializer = require('@xmldom/xmldom').XMLSerializer;

var doc = new DomParser().parseFromString(
buffer
Expand Down
178 changes: 89 additions & 89 deletions build/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/package.json
Expand Up @@ -7,7 +7,7 @@
"dependencies": {
"jsonfile": "^2.2.3",
"semver": "^5.0.3",
"xmldom": "^0.5.0",
"@xmldom/xmldom": "^0.7.5",
"read-file": "^0.2.0",
"write": "^0.3.2",
"js-yaml": "^3.7.0"
Expand Down
11 changes: 8 additions & 3 deletions build/transforms/umbpak-web.config.install.xdt
Expand Up @@ -6,14 +6,19 @@
</dependentAssembly>
<dependentAssembly xdt:Transform="Remove" xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='System.Text.Encodings.Web')">
</dependentAssembly>
<dependentAssembly xdt:Transform="InsertIfMissing" xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='Azure.Core')">
<assemblyIdentity name="Azure.Core" publicKeyToken="92742159e12e44c8" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.19.0.0" newVersion="1.19.0.0" xdt:Transform="SetAttributes" />
<dependentAssembly xdt:Transform="InsertIfMissing" xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='Azure.Core')">
<assemblyIdentity name="Azure.Core" publicKeyToken="92742159e12e44c8" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.19.0.0" newVersion="1.19.0.0" xdt:Transform="SetAttributes" />
</dependentAssembly>
<dependentAssembly xdt:Transform="InsertIfMissing" xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='System.Text.Encodings.Web')">
<assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.1" newVersion="4.0.5.1" xdt:Transform="SetAttributes" />
</dependentAssembly>
<dependentAssembly xdt:Transform="InsertIfMissing" xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='System.Diagnostics.DiagnosticSource')">
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" xdt:Transform="SetAttributes" />
</dependentAssembly>

</assemblyBinding>
</runtime>
</configuration>
Expand Up @@ -628,5 +628,28 @@ public void TestGetSubDirectoriesAndFiles()
// Tidy up after test
provider.DeleteDirectory("forms");
}

/// <summary>
/// Asserts that the file system correctly returns a sequence of directories in the
/// correct format when there are no subdirectories.
/// </summary>
[Test]
public void TestGetSubDirectoriesNone()
{
// Arrange
AzureBlobFileSystem provider = this.CreateAzureBlobFileSystem(containerName: "forms-data");
provider.AddFile("forms/b5e2fab3-040d-4328-ac74-cf7f7ebe3918.json", Stream.Null);
provider.AddFile("workflows/b5e2fab3-040d-4328-ac74-cf7f7ebe3918.json", Stream.Null);

// Act
IEnumerable<string> actual = provider.GetDirectories("forms");

// Assert
string[] expected = { };
Assert.IsTrue(expected.SequenceEqual(actual));

// Tidy up after test
provider.DeleteDirectory("forms");
}
}
}
13 changes: 7 additions & 6 deletions src/UmbracoFileSystemProviders.Azure/AzureFileSystem.cs
Expand Up @@ -518,12 +518,13 @@ public IEnumerable<string> GetDirectories(string path)
var directory = this.GetDirectoryReference(path);

var listedBlobs = directory.ListBlobs();
var prefixes = listedBlobs.Where(blob => blob.IsPrefix).Select(x=>x.Prefix).ToList();
var blobPrefixes = listedBlobs.Where(x => x.IsBlob && x.Blob.Name.LastIndexOf('/') >= 0).Select(x => x.Blob.Name.Substring(0, x.Blob.Name.LastIndexOf('/') + 1));


var prefixes = listedBlobs.Where(blob => blob.IsPrefix).Select(x => x.Prefix).ToList();
var blobPrefixes = listedBlobs.Where(x => x.IsBlob && x.Blob.Name.LastIndexOf('/') >= 0)
.Select(x => x.Blob.Name.Substring(0, x.Blob.Name.LastIndexOf('/') + 1));
// Always get last segment for media sub folder simulation. E.g 1001, 1002
var all = prefixes.Union(blobPrefixes);
var all = prefixes.Union(blobPrefixes).Where(x => !x.Equals(path + "/"));

return all.Select(cd => cd.TrimEnd('/'));
}

Expand Down Expand Up @@ -853,7 +854,7 @@ private AzureBlobDirectory GetDirectoryReference(string path)
Current.Logger.Debug<AzureBlobFileSystem>($"GetDirectoryReference(path) method executed with path:{path}");

string blobPath = this.FixPath(path);
return new AzureBlobDirectory(cloudBlobContainer,blobPath);
return new AzureBlobDirectory(cloudBlobContainer, blobPath);
}

/// <summary>
Expand Down

0 comments on commit d373e2a

Please sign in to comment.