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

Wiki: Files are not downloadable #27121

Closed
bauermarkus opened this issue Sep 18, 2023 · 4 comments · Fixed by #30273
Closed

Wiki: Files are not downloadable #27121

bauermarkus opened this issue Sep 18, 2023 · 4 comments · Fixed by #30273
Assignees
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Milestone

Comments

@bauermarkus
Copy link

Description

I tried to provide some files in the wiki via the link markdown

So I cloned the repo, I added a new folder, added the files and linked them as described here

When you click the link, the wiki opens a new page

Gitea Version

1.20.1

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Docker

Database

None

@lng2020 lng2020 added the issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented label Sep 19, 2023
@BElluu
Copy link
Contributor

BElluu commented Sep 19, 2023

Something is wrong with method WebPathToGitPath in file ./services/wiki/wiki_path.go
@bauermarkus if you need access to your files in wiki pages, for now you can create link like this:
For example, if your main branch is named master, files is directory in root
[Link name](/raw/branch/master/files/MyFile.pdf "Test Alt text")

@bauermarkus
Copy link
Author

@BElluu Thanks a lot. But if I do that, I get a 404

@denyskon denyskon added the pr/wip This PR is not ready for review label Mar 10, 2024
@rafaelsgirao
Copy link
Contributor

I'm interested in fixing this bug and would like to open a pull request soon.

I managed to reproduce this locally and made a proof-of-concept fix, which, at first glance, seems to work:
Relative links to files which are not registered as renderable by Gitea now feature a raw link instead of a regular wiki link.

Before:
image

After:
image

For reference, this is the wiki markdown file I created for testing ( Home.md ):

Welcome to the Wiki.

[Test file](files/test-file.zip "An ordinary test file")

@lunny lunny removed the pr/wip This PR is not ready for review label Mar 27, 2024
rafaelsgirao added a commit to rafaelsgirao/gitea that referenced this issue Apr 1, 2024
In Wiki pages, short-links created to local Wiki files were always expanded
as regular Wiki Links. In particular, if a link wanted to point to a file
that Gitea doesn't know how to render (e.g, a .zip file), a user following
the link would be silently redirected to the Wiki's home page.

This change makes short-links* in Wiki pages be expanded to raw wiki links,
so these local wiki files may be accessed without manually accessing their URL.

* only short-links ending in a file extension that isn't renderable are affected.

Closes go-gitea#27121.

Signed-off-by: Rafael Girão <[email protected]>
rafaelsgirao added a commit to rafaelsgirao/gitea that referenced this issue Apr 3, 2024
In Wiki pages, short-links created to local Wiki files were always expanded
as regular Wiki Links. In particular, if a link wanted to point to a file
that Gitea doesn't know how to render (e.g, a .zip file), a user following
the link would be silently redirected to the Wiki's home page.

This change makes short-links* in Wiki pages be expanded to raw wiki links,
so these local wiki files may be accessed without manually accessing their URL.

* only short-links ending in a file extension that isn't renderable are affected.

Closes go-gitea#27121.

Signed-off-by: Rafael Girão <[email protected]>
@lunny lunny added type/feature Completely new functionality. Can only be merged if feature freeze is not active. and removed type/bug labels Apr 10, 2024
@lunny lunny added this to the 1.23.0 milestone Apr 10, 2024
@lunny
Copy link
Member

lunny commented Apr 10, 2024

Since it's not by design in previous versions, I think feature is a better label for this issue.

silverwind added a commit that referenced this issue Apr 10, 2024
In Wiki pages, short-links created to local Wiki files were always
expanded as regular Wiki Links. In particular, if a link wanted to point
to a file that Gitea doesn't know how to render (e.g, a .zip file), a
user following the link would be silently redirected to the Wiki's home
page.

This change makes short-links* in Wiki pages be expanded to raw wiki
links, so these local wiki files may be accessed without manually
accessing their URL.

* only short-links ending in a file extension that isn't renderable are
affected.

Closes #27121.

Signed-off-by: Rafael Girão <[email protected]>
Co-authored-by: silverwind <[email protected]>
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Jul 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants