# Attachment Links module for Drupal fixes for in-browser downloads — Liran Tal

The Attachment Links module provides permanent links to files attached to a node. A single, easy-to-remember URL can be used to retrieve the preferred (canonical) or newest version of a file regardless of how many versions of that file have been attached to a node.

Canonical: https://lirantal.com/blog/2012-12-19

![Cover artwork for Attachment Links module for Drupal fixes for in-browser downloads](/_astro/photo-1468956398224-6d6f66e22c35.BePqp3CW_Zj88Tk.jpg)

If to quote the attachment links project on Drupal: `The Attachment Links module provides permanent links to files attached to a node. A single, easy-to-remember URL can be used to retrieve the preferred (canonical) or newest version of a file regardless of how many versions of that file have been attached to a node`.

Incase the light-bulb didn’t turn on yet for you – with Drupal, if you upload a file attachment then if it doesn’t exist yet it will be saved as .tar.gz. If the user then updates that node with a new file upload of the same name, the filename will change to \_1.tar.gz and so on since Drupal will transliterate and correct the filename to make sure such file doesn’t exist yet in it’s files directory.

The `Attachment Links` module mitigates this problem by allowing you to specify a link like `node/2600/attachment` and by doing that it’s controller will already pull the correct file attachment for this node and send it over the wire. This enables you to give permanent links (in the form of `http://example.com/node/2600/attachment`) because otherwise the exact file system link will always change when you update the file entry.

So far that was a somewhat short introduction to the use-case for `Attachment Links` module.

As with most modules, they don’t always scratch your exact itch (@see [http://en.wikipedia.org/wiki/The\_Cathedral\_and\_the\_Bazaar](http://en.wikipedia.org/wiki/The_Cathedral_and_the_Bazaar) guideline number 1), and so for us we had the issue that attachments do no retain their original `Content-Type` header. Meaning, every file will be forced to download so that if `node/2600/attachment` is actually sending over a `readme.txt` file, instead of that file to open up in the browser (which was the required case for us) it got downloaded. Same for images, PDFs, etc.

We found it a bit annoying so worked on a fix to maintain this original behavior while still working with this module. For your enjoyment: [http://drupal.org/node/1856422](http://drupal.org/node/1856422)

## More writing

[All writing](/blog)

*   Sep 5, 2026

    ### [Self-Hosting Hermes Agent with Matrix E2EE on Proxmox](/blog/self-host-hermes-agent-matrix-e2ee-proxmox)

*   Aug 2, 2026

    ### [The Practical Second Brain: Building an LLM-Operated Markdown Knowledge Graph](/blog/practical-second-brain-llm-markdown-knowledge-graph)

*   Aug 1, 2026

    ### [Building a Second Brain with LLMs and AI Agents](/blog/building-second-brain-llms-ai-agents)


* * *

Liran Tal is the author of the book [Node.js Secure Coding: Defending Against Command Injection Vulnerabilities](https://www.nodejs-security.com/)

[Start Building Secure Node.js Applications](https://www.nodejs-security.com/)

 [![](/_astro/nodejs-secure-coding-book-3d-style.DiTWpzFs_Z3c7s1.png)](https://www.nodejs-security.com/)
