Skip to content
Snippets Groups Projects

Add file attachment submodule

Closes #3526226

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • added 1 commit

    Compare with previous version

  • added 1 commit

    • 104cca29 - Replace content entity interface

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    • 5993537c - Replace extension with mime type

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • Dezső Biczó added 1 commit
  • Dezső Biczó added 1 commit

    added 1 commit

    • 05232cc3 - The entity is always a file in this case

    Compare with previous version

  • Dezső Biczó added 1 commit

    added 1 commit

    Compare with previous version

  • @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

    • ac17bb74 - #3527544 - Improve Hook Alterations and Cache Metadata Handling in Markdownify Module

    Compare with previous version

  • Arash Poorakbar added 14 commits

    added 14 commits

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    • 16cdf7f2 - Leverage new bubbleable metadata

    Compare with previous version

  • Dezső Biczó
  • added 1 commit

    Compare with previous version

  • added 1 commit

    • 840642f7 - Omit formatting around filename, mime type and URL, because it is escaped...

    Compare with previous version

  • Dezső Biczó
  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • 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:

    1. The Drupal YAML Serialization Implementation: only recognizes .yml as the only valid YAML file extension.

      See Drupal\Core\Serialization\Yaml##L50-L52

      1

    2. 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 of example.info.yml results in Drupal failing to detect the module altogether.

      See Drupal\Core\Extension\Extension##L50-L52

      2

      Reference: Drupal Module Info File Documentation.

      "Let Drupal know about your module with an .info.yml file."

    3. 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.

    4. 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?

    1. Should we open a new issue on Drupal Core to start a discussion and see what the community thinks about it?
    2. Pretend I didn't see anything on the IANA registry about the YAML Media Type and do nothing?
    3. ...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.
  • This does not affect the Markdownify File Attachment submodule, nor YAML files attached to content entities (I have tested the latter dozens of times). So we can let it rest as far as this merge request goes, provided that the submodule properly deals with both extensions.

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading