Skip to content

Pull request creation to forked repository via web api fails #20475

Closed
@lixfel

Description

@lixfel

Description

Gitea prevents pull request creation with the web api from the original repository to the fork with the error message: <Response [404]> b'{"errors":null,"message":"GetForkedRepo","url":"https://try.gitea.io/api/swagger"}\n'.

I managed to reproduce the issue on https://try.gitea.io/Lixfel/FreeSql .

Reproduction code:

token = "?"
import requests
response = requests.post(
        f'https://try.gitea.io/api/v1/repos/Lixfel/FreeSql/pulls?token={token}',
        json={
            "base": "master",
            "head": "huihuiyule:master",
            "title": "Update Upstream"
        })
print(f"{response} {response.content}")

Bug origin assumption:
https://github.com/go-gitea/gitea/blob/main/routers/api/v1/repo/pull.go#L967 seems to only allow PRs from the fork to the original repository, a method call GetForkingRepo is missing.

Gitea Version

1.16.9

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

https://gist.github.com/lixfel/e0c36e3b85a1b8ffbf994baf275e49bd

Screenshots

No response

Git Version

1:2.30.2-1 (apt version)

Operating System

Debian

How are you running Gitea?

Use of Gitea Downloads site; execution with systemd

Database

MySQL

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions