Display of FTP links in markdown #4104

Closed
opened 2025-11-02 05:38:03 -06:00 by GiteaMirror · 9 comments
Owner

Originally created by @bkmgit on GitHub (Oct 12, 2019).

Description

Markdown does not render ftp links correctly
Similar issue appears here
...

Screenshots

FTP_links

Originally created by @bkmgit on GitHub (Oct 12, 2019). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.9.3 - Git version: 2.1.9 - Operating system: Cent OS 7 - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [X] MariaDB - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ X] Yes (provide example URL) https://try.gitea.io/bkmgit/TestMarkdown/src/branch/master/README.md - [ ] No - [ ] Not relevant - Log gist: ## Description Markdown does not render ftp links correctly Similar issue appears [here](https://github.com/gollum/gollum/issues/759) ... ## Screenshots <!-- **If this issue involves the Web Interface, please include a screenshot** --> ![FTP_links](https://user-images.githubusercontent.com/1679477/66697234-7451f800-ecdc-11e9-9caf-dc8666f6d73f.png)
GiteaMirror added the type/enhancement label 2025-11-02 05:38:04 -06:00
Author
Owner

@guillep2k commented on GitHub (Oct 12, 2019):

I thought it was intentional after reading this:
Google Chrome 82 won't support FTP anymore

@guillep2k commented on GitHub (Oct 12, 2019): I thought it was intentional after reading this: [Google Chrome 82 won't support FTP anymore](https://www.ghacks.net/2019/08/16/google-chrome-82-wont-support-ftp-anymore/)
Author
Owner

@bkmgit commented on GitHub (Oct 13, 2019):

It seems Markdown is rendered using gomarkdown
A number of sites offer ftp, in particular for download only, and it is helpful to be able to link directly to these. Not all people, use Chrome. Being able to view contents and download from a browser is helpful. A number of places in the world have slow internet connections, where a factor of two difference in download speed is significant, some numbers here. While ftp is not as secure as the other protocols, one can still verify a download using a hash eg. sha256sum.

@bkmgit commented on GitHub (Oct 13, 2019): It seems Markdown is rendered using [gomarkdown](https://github.com/gomarkdown/markdown) A number of sites offer ftp, in particular for download only, and it is helpful to be able to link directly to these. Not all people, use Chrome. Being able to view contents and download from a browser is helpful. A number of places in the world have slow internet connections, where a factor of two difference in download speed is significant, some numbers [here](https://serverfault.com/questions/131240/ftp-v-s-sftp-v-s-ftps). While ftp is not as secure as the other protocols, one can still verify a download using a hash eg. sha256sum.
Author
Owner

@bkmgit commented on GitHub (Oct 13, 2019):

Seems blackfriday supports links to ftp sites, https://github.com/russross/blackfriday/blob/master/inline_test.go

@bkmgit commented on GitHub (Oct 13, 2019): Seems [blackfriday](https://github.com/russross/blackfriday) supports links to ftp sites, https://github.com/russross/blackfriday/blob/master/inline_test.go
Author
Owner

@bkmgit commented on GitHub (Oct 13, 2019):

@bkmgit commented on GitHub (Oct 13, 2019): * It may be helpful to add the option blackfriday.EXTENSION_AUTOLINK | in https://github.com/go-gitea/gitea/blob/master/modules/markup/markdown/markdown.go at around line 126 * Currently seem to be using blackfriday v1, might it be worth upgrading to blackfriday v2?
Author
Owner

@bkmgit commented on GitHub (Oct 13, 2019):

  • URI entries that can be made links are determined by following bluemonday policies. In gitea these are set by line 40 of modules/markup/sanitizer.go which currently uses defaults from bluemonday, which are equivalent to sanitizer.policy.AllowURLSchemes("mailto", "http", "https"). To enable links to ftp, possibly also git and other protocols one observes that line 146 in /custom/conf/app.ini.sample is CUSTOM_URL_SCHEMES =
    and modifying it to
    CUSTOM_URL_SCHEMES = https,http,mailto,ftp,git
    and update the documentation on this configuration option would allow easy setting of what links will be set as hyperlinks rather than rendered as plain text. On an install of Gitea on Cent OS 7, by adding an entry to the /etc/gitea/app.ini with

[markdown]
CUSTOM_URL_SCHEMES = https,http,mailto,ftp
could get hyperlinks with ftp protcol.

  • It seems that Macaron is used to serve the webpages. Changing modules/validation/validurl_test.go to allow for all links in app.ini would probably also be helpful.

  • Documentation similar to what is available for configuring Black Monday in Hugo, here would likely be helpful for those for whom the defaults are not the best choice. At present documentation configuration cheat sheet is lacking a section on markdown parsing, although the link to sample configuration file app.ini.sample does have this.

@bkmgit commented on GitHub (Oct 13, 2019): * URI entries that can be made links are determined by following [bluemonday](https://github.com/microcosm-cc/bluemonday) policies. In gitea these are set by line 40 of [modules/markup/sanitizer.go](https://github.com/go-gitea/gitea/blob/801843b0115e29ba2304fa6a5bea1ae169a58e02/modules/markup/sanitizer.go) which currently uses defaults from [bluemonday](https://github.com/microcosm-cc/bluemonday), which are equivalent to sanitizer.policy.AllowURLSchemes("mailto", "http", "https"). To enable links to ftp, possibly also git and other protocols one observes that line 146 in [/custom/conf/app.ini.sample](https://github.com/go-gitea/gitea/blob/801843b0115e29ba2304fa6a5bea1ae169a58e02/custom/conf/app.ini.sample) is CUSTOM_URL_SCHEMES = and modifying it to CUSTOM_URL_SCHEMES = https,http,mailto,ftp,git and update the documentation on this configuration option would allow easy setting of what links will be set as hyperlinks rather than rendered as plain text. On an install of Gitea on Cent OS 7, by adding an entry to the /etc/gitea/app.ini with [markdown] CUSTOM_URL_SCHEMES = https,http,mailto,ftp could get hyperlinks with ftp protcol. * It seems that [Macaron](https://gitea.com/macaron/binding) is used to serve the webpages. Changing [modules/validation/validurl_test.go](https://github.com/go-gitea/gitea/blob/801843b0115e29ba2304fa6a5bea1ae169a58e02/modules/validation/validurl_test.go) to allow for all links in app.ini would probably also be helpful. * Documentation similar to what is available for configuring Black Monday in Hugo, [here](https://gohugo.io/getting-started/configuration/#configure-blackfriday) would likely be helpful for those for whom the defaults are not the best choice. At present documentation [configuration cheat sheet](https://docs.gitea.io/en-us/config-cheat-sheet/) is lacking a section on markdown parsing, although the link to sample configuration file [app.ini.sample](https://github.com/go-gitea/gitea/blob/master/custom/conf/app.ini.sample) does have this.
Author
Owner

@bkmgit commented on GitHub (Oct 13, 2019):

If updating the documentation on Markdown display is useful, can do this.

@bkmgit commented on GitHub (Oct 13, 2019): If updating the documentation on Markdown display is useful, can do this.
Author
Owner

@guillep2k commented on GitHub (Oct 13, 2019):

Hey, don't sweat it. I too wondered "why doesn't this support ftp?" when browsing that part of the code. If nobody is against it, I might take this within next week. However, with our current release schedule I'm not sure when will it be released.

@guillep2k commented on GitHub (Oct 13, 2019): Hey, don't sweat it. I too wondered "why doesn't this support ftp?" when browsing that part of the code. If nobody is against it, I might take this within next week. However, with our current release schedule I'm not sure when will it be released.
Author
Owner

@bkmgit commented on GitHub (Oct 14, 2019):

@guillep2k Ok. Partially addressed in #8497 and #8498

@bkmgit commented on GitHub (Oct 14, 2019): @guillep2k Ok. Partially addressed in #8497 and #8498
Author
Owner

@bkmgit commented on GitHub (Oct 14, 2019):

@guillep2k Thanks for implementing #8496

@bkmgit commented on GitHub (Oct 14, 2019): @guillep2k Thanks for implementing #8496
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4104