Exemple #1
0
        protected override async Task<HttpResponseMessage> CreateDirectoryPutResponse(DirectoryInfoBase info, string localFilePath)
        {
            using (var stream = await Request.Content.ReadAsStreamAsync())
            {
                // The unzipping is done over the existing folder, without first removing existing files.
                // Hence it's more of a PATCH than a PUT. We should consider supporting both with the right semantic.
                // Though a true PUT at the root would be scary as it would wipe all existing files!
                var zipArchive = new ZipArchive(stream, ZipArchiveMode.Read);
                zipArchive.Extract(localFilePath);
            }

            return Request.CreateResponse(HttpStatusCode.OK);
        }