Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for archiving by directory using AzureStorageDriver #53

Closed
jizzaki opened this issue Dec 15, 2020 · 2 comments
Closed

Support for archiving by directory using AzureStorageDriver #53

jizzaki opened this issue Dec 15, 2020 · 2 comments

Comments

@jizzaki
Copy link

jizzaki commented Dec 15, 2020

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.

@fsmirne
Copy link
Contributor

fsmirne commented Dec 18, 2020

This can be closed. I handled it in the AzureStorage code.

@gordon-matt
Copy link
Owner

Thanks @fsmirne .
@jizzaki : for Azure driver issues, please open them in the Azure driver repo next time: https://github.com/fsmirne/elFinder.NetCore.AzureStorage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants