forgejo/templates
0ko 2382b74526 feat(ui): add MIME types for generated archives (#6959)
* add MIME types `application/zip` and `application/gzip` to anchors of automatically generated archives.
* add testing for that, and also for https://codeberg.org/forgejo/forgejo/pulls/2899

## Why

Many instances are struggling with crawlers that are fetching these links, causing archives to be generated. The content is actually never downloaded.

[MDN describes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#type) this attribute as a "hint". So this hint can help a client to decide against fetching the href contents. I don't believe this change will actually improve the situation, however, I think this attribute is nice to have.

## MIME types

It was a bit difficult to determine which are the right ones for this use case.
[IANA lists](https://www.iana.org/assignments/media-types/media-types.xhtml) both `application/zip` and `application/gzip`.
`application/zip` refers to [RFC6713](https://datatracker.ietf.org/doc/html/rfc6713) and `application/gzip` doesn't refer to an RFC directly. It also has [detailed information](https://www.iana.org/assignments/media-types/application/zip) about zip. [gzip is less detailed](https://www.iana.org/assignments/media-types/application/gzip).

* [`application/zip`](https://www.iana.org/assignments/media-types/application/zip):
    > ZIP files are binary data and thus should be encoded for MIME mail
transmission.

    This was written in 1993, but probably applies to the more modern web as well.
* [`application/gzip`](https://datatracker.ietf.org/doc/rfc6713):
    > The 'application/gzip' media type describes a block of data that is
   compressed using gzip [RFC1952] compression.  The data is a stream of
   bytes as described in RFC 1952.

    [RFC1952](https://datatracker.ietf.org/doc/rfc1952/) is a "GZIP file format specification", but there's a warning: "This RFC is not endorsed by the IETF and has no formal standing in the IETF standards process.". Anyway, I consider it as the right way to mark .tar.gz files too.

Additional stuff that I read while researching:
* https://stackoverflow.com/questions/2110269/add-mime-type-to-html-link

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6959
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
Co-authored-by: 0ko <0ko@noreply.codeberg.org>
Co-committed-by: 0ko <0ko@noreply.codeberg.org>
2025-02-16 12:59:28 +00:00
..
admin Add "No data available" display when list is empty (#33517) 2025-02-09 10:25:18 +01:00
api/packages/pypi Update templates/api/packages/pypi/simple.tmpl 2024-04-12 16:43:30 +00:00
base Rewrite OpenGraph Header 2025-01-01 20:43:20 +01:00
custom [FEAT] Repository flags 2024-02-05 16:09:42 +01:00
devtest [PORT] Refactor DateUtils and merge TimeSince (gitea#32409) 2024-11-10 22:23:27 +01:00
explore ui: simplify main-attribute labels 2024-12-08 17:30:52 +05:00
htmx Update module github.com/editorconfig-checker/editorconfig-checker/v2/cmd/editorconfig-checker to v3 2024-08-09 21:03:37 +02:00
mail Merge pull request '[SEC] Notify owner about TOTP enrollment' (#4704) from gusted/sec-more-totp into forgejo 2024-07-27 20:53:47 +00:00
org fix(ui): hide 'New migration' button on org pages with migrations disabled (#6850) (#6851) 2025-02-08 15:06:02 +00:00
package Alt Linux Apt-Rpm repository support for Forgejo packages. (#6351) 2025-01-22 14:01:49 +00:00
projects fix(sec): permission check for project issue 2025-02-08 07:22:10 +00:00
repo feat(ui): add MIME types for generated archives (#6959) 2025-02-16 12:59:28 +00:00
shared feat: add pronoun privacy option (#6773) 2025-02-15 13:07:15 +00:00
status chore(branding): strip metadata information from the footer 2024-12-29 22:40:13 +00:00
swagger feat: add pronoun privacy option (#6773) 2025-02-15 13:07:15 +00:00
user feat: add pronoun privacy option (#6773) 2025-02-15 13:07:15 +00:00
webhook fix: improve discord webhook api conformance 2024-10-08 22:43:28 +02:00
home.tmpl Split Forgejo landing page template to allow patching or removing Forgejo introduction section (#6675) 2025-02-03 08:41:52 +00:00
home_forgejo.tmpl Split Forgejo landing page template to allow patching or removing Forgejo introduction section (#6675) 2025-02-03 08:41:52 +00:00
install.tmpl Added alt's to <img> 2025-01-31 21:22:00 +00:00
post-install.tmpl [BRANDING] Custom loading animation for Forgejo 2024-02-05 16:02:13 +01:00