Skip to content

cannot create *relative* link to *raw* view in markdown. #34104

Closed
@juleskers

Description

@juleskers

Feature Description

I'm trying to generate relative README.md links to the raw-views for some files in a self-hosted repo.
(That keep working if someone forks, or if I move my project from personal playground to team-org).

Gitea supports relative links (e.g. [config example](config.example), which turns into https://gitea.local/$USER/$REPO/src/branch/main/config.example)
Gitea also supports raw views, i.e. https://gitea.local/$USER/$REPO/raw/branch/main/config.example. (replacing src in link with raw)

What I cannot get working is relative links to raw.

  • [config example](raw/config.example) -> HTTP 404:
    (turns into https://gitea.local/$USER/$REPO/src/branch/main/raw/config.example`, i.e. "raw" is interpreted as a relative folder (which is the only sensible thing to do)
  • [config example](/raw/config.example) (leading slash) turns into gitea.local/raw/config.example (i.e. makes it an absolute link from base-url. Again this is the sensible, HTTP-spec-conforming thing to do.
  • appending ?raw=1 (the way github solves it, according to stackOverflow) -> opens the normal, non-raw view.

Is there any way to tell the link-rewriter to use 'raw' instead of 'src'?
If so: where did I overlook the documentation?
If not: can we add something (preferably a redirect if &raw=1 is present, for github compatibility, though alternatives welcome)

Side note: I run into exactly the same problem in GitLab, where GL uses /-/blob/ where gitea has /src/, and GL:/-/raw/ for gitea:/raw/.
GitLab also doesn't handle ?raw=1.

Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/proposalThe new feature has not been accepted yet but needs to be discussed first.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions