Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display of FTP links in markdown #8478

Closed
1 of 7 tasks
bkmgit opened this issue Oct 12, 2019 · 9 comments · Fixed by #8496
Closed
1 of 7 tasks

Display of FTP links in markdown #8478

bkmgit opened this issue Oct 12, 2019 · 9 comments · Fixed by #8496
Labels
type/enhancement An improvement of existing functionality

Comments

@bkmgit
Copy link
Contributor

bkmgit commented Oct 12, 2019

Description

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

Screenshots

FTP_links

@lunny lunny added the type/enhancement An improvement of existing functionality label Oct 12, 2019
@guillep2k
Copy link
Member

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

@bkmgit
Copy link
Contributor Author

bkmgit commented 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
Copy link
Contributor Author

bkmgit commented Oct 13, 2019

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

@bkmgit
Copy link
Contributor Author

bkmgit commented Oct 13, 2019

@bkmgit
Copy link
Contributor Author

bkmgit commented 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
Copy link
Contributor Author

bkmgit commented Oct 13, 2019

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

@guillep2k
Copy link
Member

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.

@bkmgit
Copy link
Contributor Author

bkmgit commented Oct 14, 2019

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

@bkmgit
Copy link
Contributor Author

bkmgit commented Oct 14, 2019

@guillep2k Thanks for implementing #8496

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants