Add file attachment submodule
Closes #3526226
Merge request reports
Activity
- Resolved by Christoph Weber
- Resolved by Arash Poorakbar
- Resolved by Arash Poorakbar
- Resolved by Arash Poorakbar
- Resolved by Arash Poorakbar
- Resolved by Arash Poorakbar
- Resolved by Arash Poorakbar
- Resolved by Arash Poorakbar
- Resolved by Christoph Weber
- Resolved by Christoph Weber
- Resolved by Christoph Weber
- Resolved by Christoph Weber
@AdrianAndres and I decided to add a hook to the build stage in a separate issue and MR. The new hook will allow this submodule to run at the right time, include contextual information from attached files in the right place by following the filefield's place in the view mode, and allow other code to alter the output via the current hook if necessary. Altering output during the build stage also makes access checks unnecessary because the build stage includes them. This MR here should target the new hook for correct function. Expect updated code with the new hook before the weekend is over.
added 1 commit
added 14 commits
-
0f45ca06 - 1 commit from branch
project:1.0.x
- 0f45ca06...d4b8d151 - 3 earlier commits
- 9921388a - Replace content entity interface
- 59fad118 - Delete doc from extensions
- 18fb04b4 - Replace extension with mime type
- 499b51f0 - Add cache bubble up
- d264154f - Modify cacheability logic
- 46368860 - Add new line
- eaab5487 - Remove white space
- ad197729 - Fixes
- 09ec7364 - The entity is always a file in this case
- 6f2f1cf3 - Spare words and lines
Toggle commit list-
0f45ca06 - 1 commit from branch
- Resolved by Arash Poorakbar
- Resolved by Arash Poorakbar
- Resolved by Christoph Weber
added 1 commit
- 840642f7 - Omit formatting around filename, mime type and URL, because it is escaped...
- Resolved by Christoph Weber
- Resolved by Arash Poorakbar
- Resolved by Arash Poorakbar
- Resolved by Christoph Weber
- Resolved by Christoph Weber
- Resolved by Arash Poorakbar
- Resolved by Arash Poorakbar
- Resolved by Arash Poorakbar
- Resolved by Arash Poorakbar
Hey Guys, sorry for dropping this here, but since I discovered this while working on this MR, I thought it would be useful to document my findings here before I forget.
The Context:
While documenting my thoughts in this thread, I stumbled upon an important update from February 2024: the Internet Assigned Numbers Authority (IANA) and the Internet Engineering Task Force (IETF) have reached a consensus on the preferred standard file extensions for YAML files.
From RFC 9512 - YAML Media Type: Section 3.3 - Filename Extensions:
The "yaml" filename extension is the preferred one; it is the most popular and widely used on the web. The "yml" filename extension is still used. The simultaneous usage of two filename extensions in the same context might cause interoperability issues (e.g., when both a "config.yaml" and a "config.yml" are present).
File extension(s): "yaml" (preferred) and "yml". See Section 3.3 of this document.
From Discussion on StackOverflow:
...the recommendation is to use
.yaml
when possible... ...some projects use.yml
mostly because of ignorance of the implementers/documenters: they wanted to use YAML because of readability or some other feature not available in other formats, were not familiar with the recommendation, and just implemented what worked—maybe after looking at some other project/library (without questioning whether what was done is correct).
The Problem:
In the context of Drupal, At first glance, this might seem like a minor or arbitrary project preference. However, the issue is not just that Drupal heavily uses
.yml
. The real bug is that Drupal does not even recognize.yaml
as a valid YAML extension, despite it being the IETF-preferred standard, because it has hardcoded only the "yml" extension in all its APIs and components.Examples:
-
The Drupal YAML Serialization Implementation: only recognizes
.yml
as the only valid YAML file extension. -
Extension Discovery Mechanism: The file discovery mechanism for modules, themes, profiles, etc., is hardcoded to work only with
.yml
files.This means that defining a module as
example.info.yaml
instead ofexample.info.yml
results in Drupal failing to detect the module altogether.See
Drupal\Core\Extension\Extension##L50-L52
Reference: Drupal Module Info File Documentation.
"Let Drupal know about your module with an
.info.yml
file." -
Configuration Management: Drupal only reads config objects from files with the
.yml
extension.See https://www.drupal.org/docs/develop/coding-standards/configuration-file-coding-standards#filename
The configuration file name is equal to the unique configuration name with .yml extension.
-
etc.: Essentially, everything is hardcoded to work with just
.yml
files.
My Concern:
The bug does not reside in using "yml" everywhere. The bug resides in not even recognizing "yaml" as a valid extension for YAML files.
I am wondering what implications it has that the Internet Engineering Task Force in the YAML media type stated that the File extension(s): "yaml" is preferred for anything used on the Internet.
Knowing that Drupal does not honor that and does not even recognize the "yaml" extension for anything that it does internally is concerning.
Open Questions for the Team:
What should I do?
- Should we open a new issue on Drupal Core to start a discussion and see what the community thinks about it?
- Pretend I didn't see anything on the IANA registry about the YAML Media Type and do nothing?
- ...Join Elon Musk and start a new life on Mars and leave this problem behind?
Looking forward to hearing your thoughts!
Edited by Adrian M.-