fsmirne / elfinder.netcore.azurestorage Goto Github PK
View Code? Open in Web Editor NEWMicrosoft Azure Storage driver for elFinder.NetCore
License: MIT License
Microsoft Azure Storage driver for elFinder.NetCore
License: MIT License
The BaseDriver only supports archiving local folders and files.
Please add an override to the AzureStorageDriver with the following:
protected override async Task AddDirectoryToArchiveAsync(ZipArchive zipFile, IDirectory directoryInfo, string root)
{
string entryName = $"{root}{directoryInfo.Name}/";
zipFile.CreateEntry(entryName);
var dirs = await directoryInfo.GetDirectoriesAsync();
foreach (var dir in dirs)
{
await AddDirectoryToArchiveAsync(zipFile, dir, entryName);
}
var files = await directoryInfo.GetFilesAsync(null);
foreach (var file in files)
{
var filePath = Path.GetTempFileName();
File.WriteAllBytes(filePath, await AzureStorageAPI.FileBytesAsync(file.FullName));
zipFile.CreateEntryFromFile(filePath, entryName + file.Name);
}
}
This will allow us to retrieve files from Azure Instead and write to a temp directory. This currently does not exist in the AzureStorageDriver and fails every time you try to archive by directory/folder name.
Bug in file AzureStorageAPI.cs line 356.
When renaming or moving a directory this method will fail if that directory contains files. Microsoft's directory DeleteAsync() method will not delete a directory that contains files. I'm new to Github my apologies for not submitting a pull request.
Issue:
public static async Task MoveDirectoryAsync(string source, string destination)
{
await CopyDirectoryAsync(source, destination);
var rootDir = GetRootDirectoryReference(source);
var sourceDir = rootDir.GetDirectoryReference(RelativePath(source));
await sourceDir.DeleteAsync();
}
Recommended solution:
public static async Task MoveDirectoryAsync(string source, string destination)
{
await CopyDirectoryAsync(source, destination);
// In order to delete a directory it must first be empty per Microsoft
// https://docs.microsoft.com/en-us/rest/api/storageservices/delete-directory
// Instead, we should recursively delete the subfolders, files, and lastly the source folder.
await DeleteDirectoryAsync(source);
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.