Skip to content

DownloadFile feature request: useSourceFileName flag and FileExistsAction: Throw Exception|Overwrite|Rename #41

@jsalmela

Description

@jsalmela

Was trying to replace the custom task that I wrote with this but this lacks some features.
So if useSourceFileName == true, try get the sourceFileName from the Content-Disposition header. Something like this:

            HttpResponseMessage response = await RequestGetAsync(input);

            HttpContentHeaders headers = response.Content.Headers;
            if (String.IsNullOrEmpty(fileName) && headers.ContentDisposition != null)
            {
                fileName = headers.ContentDisposition.FileName.Trim('"');
            }

           if (String.IsNullOrEmpty(fileName))
            {
                throw new Exception("Filename is empty! HTTP-Response headers: \n"+ headers.ToString());
            }

And FileExistsAction: Throw Exception|Overwrite|Rename would be nice addition too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions