-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
FeatureIntroducing new capabilities.Introducing new capabilities.
Milestone
Description
The Content-Disposition HTTP response header can be used to transmit the file's name, including its file extension.
Within Ember Nexus, it should work in the following way:
- The
Content-DispositionHTTP header is always set toattachment; filename="<name>.<extension>" - The file name is decided by priority, starting with the following option:
- The
name-property of the current element, if it a) exists and b) is of type string. - The id of the current element, in string form.
- The
- The extension is decided through the following options (already calculated during upload):
- The original file extension, if the original upload contained a
Content-Dispositionheader on its own. - A file extension determined by mime type lookup of the file itself.
- If the extension can not be determined, the fallback extension
.binis used.
- The original file extension, if the original upload contained a
- The following constraints are placed on the file name:
- The whole file name, i.e.
<name>.<extension>, is limited to 255 characters - a normal limit by filesystems like NTFS, Btrfs, ext4 and exFAT are all limited to 256 bytes / chars. See also Wikipedia list of file system limits. - If the file name limit is exceeded, then the name part is truncated from the right as much as required. The extension itself can not be truncated.
- Special characters need to be removed from the file name, notably:
"*/:<>?\|source, Wikipedia
- The whole file name, i.e.
Note: The filename can not be directly changed by clients; they can only change the element's name. The file extension itself is linked to the representation, which can only be changed by re-uploading the file (or another representation).
Acceptance criteria:
- The
Content-DispositionHTTP header is supported for file uploads. - The
Content-DispositionHTTP header is supported for file downloads. - The file name is correctly generated, sanitized and truncated.
- Unit tests.
- Feature tests.
- Documentation.
- Todo: What about the RFC 5987 filename encoding? Should we support it? Is it easy to support?
See also:
Metadata
Metadata
Assignees
Labels
FeatureIntroducing new capabilities.Introducing new capabilities.
Type
Projects
Status
No status