Skip to main content










 

















When trying to download a zip archive from a query parameter in url with box id, I receive the downloaded file successfully. However, it's missing the ".zip" extension in its name. For example, if the zip archive is named "downloadzip", the downloaded file should ideally be named "downloadzip.zip", but it isn't. Am I missing something? According to this article (https://developer.box.com/reference/post-zip-downloads/), it explicitly states that ".zip" is added from the Box API.

public async Task<MemoryStream> GetStreamForZip(string csvFileIds)








        {
            var fileIds = csvFileIds.Split(',');            
            var request = new BoxZipRequest
            {
                Name = "downloadzip",
                Items = fileIds.Select(fileId => new BoxZipRequestItem
                {
                    Id = fileId.Trim(),
                    Type = BoxZipItemType.file
                }).ToList()
            };            using (MemoryStream ms = new MemoryStream())
            {
                await BoxClient.FilesManager.DownloadZip(request, ms);
                ms.Position = 0;
                return ms;
            }
        }























kFunctionName("downloadzip")]
public static async Task<IActionResult> DownloadZip( HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, ILogger log)
{
    try
    {
        string id = req.QueryF"id"];
        if (string.IsNullOrEmpty(id))
        {
            return new BadRequestObjectResult("Document id is not passed. Pass id as request param.");
        }        var stream = await _boxIntegrationService.GetStreamForZip(id);        if (stream == null)
        {
            return new BadRequestObjectResult("The file is not found");
        }        var bytes = stream.ToArray();        
return new FileContentResult(bytes, "application/octet-stream");
    }
    catch (Exception ex)
    {
        return new BadRequestObjectResult(ex.Message);
    }
}











Hi Samir, 


Welcome to Box Community and glad to assist!


I have created a ticket and a member from Product Support will get in touch, please keep an eye out. 


Thanks for posting!


Hi there,


Thanks for letting me know. It's been a bit since I created the ticket. Is there anything else I should do to speed things up? Your help would be appreciated.


Hope to hear from you soon.


Regards,


Reply