Skip to content

Should downloadWillBegin suggestedFilename match actual filename on local filesystem? #982

@juliandescottes

Description

@juliandescottes

I'm not sure I understand how suggestedFilename is intended to be defined.

Based on https://html.spec.whatwg.org/#getting-the-suggested-filename , it says (step 12):

Let filename be set to the user's preferred filename or to a filename selected by the user agent

Which means in case the browser prompts the user to select a location and filename, it should incorporate it.

It also says (step 14):

Adjust filename to be suitable for the local file system.

When downloading a file which has a name already used in the filesystem, both Firefox and Chrome will add a counter (1), (2) before the extension. For instance click several times on the link in https://bug1874365.bmoattachments.org/attachment.cgi?id=9506609

Does this mean the (1) etc... is part of the suggested filename? In a sense it was adapted to the local file system by adding some unique identifier to it.

From #840 , the motivation behind adding suggestedFilename was to allow users to perform cleanup, so it seems to me we should be as faithful as possible to the name used on the filesystem?

I am asking because right now the wdspec test saves using the same filename several times, and I can actually see that the second time it adds a (1) in the filename, but Chrome doesn't report it in the suggested filename.

Possibly a bug in Chrome's implementation, but the HTML spec is a bit vague on this topic. cc @sadym-chromium

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions