Skip to content

[API] Timeline API throwing 500 error when time tracking is used #21041

Closed
@mmarif4u

Description

@mmarif4u

Description

If you add manual time to an issue or pr, the API timeline will throw an internal server error (500). This happens for removing manual time and stop time tracking types too.

Types: https://github.com/go-gitea/gitea/blob/main/models/issues/comment.go#L135

I haven't dig the code, but @qwerty287 mentioned to point this out. https://github.com/go-gitea/gitea/blob/main/modules/convert/issue.go#L116

Error log:

2022/09/03 12:58:18 ...common/middleware.go:71:1() [E] [6313091a-5] PANIC: runtime error: invalid memory address or nil pointer dereference
        /usr/local/go/src/runtime/panic.go:220 (0x453095)
        /usr/local/go/src/runtime/signal_unix.go:818 (0x453065)
        /source/modules/convert/issue.go:116 (0x1b698c8)
        /source/modules/convert/issue_comment.go:104 (0x1b6b026)
        /source/routers/api/v1/repo/issue_comment.go:190 (0x207da12)
        /source/modules/web/wrap_convert.go:63 (0x1f44f16)
        /source/modules/web/wrap.go:41 (0x1f433c9)
        /usr/local/go/src/net/http/server.go:2084 (0x93cace)
        /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:442 (0x1732c55)
        /usr/local/go/src/net/http/server.go:2084 (0x93cace)
        /source/modules/web/wrap.go:98 (0x1f43f54)
        /usr/local/go/src/net/http/server.go:2084 (0x93cace)
        /source/modules/web/wrap.go:98 (0x1f43f54)
        /usr/local/go/src/net/http/server.go:2084 (0x93cace)
        /source/modules/context/api.go:277 (0x1b0f811)
        /usr/local/go/src/net/http/server.go:2084 (0x93cace)
        /source/routers/api/v1/api.go:1174 (0x20c9bd3)
        /usr/local/go/src/net/http/server.go:2084 (0x93cace)
        /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:71 (0x1730a8c)
        /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:314 (0x173243b)
        /usr/local/go/src/net/http/server.go:2084 (0x93cace)
        /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.7/mux.go:442 (0x1732c55)
        /usr/local/go/src/net/http/server.go:2084 (0x93cace)
        /source/routers/common/middleware.go:79 (0x1fb0122)  


2022/09/03 12:58:18 [6313091a-5] router: failed    GET /api/v1/repos/GitNex/gitnex/issues/6/timeline?limit=50 for 192.168.10.58:57772, panic in 37.2ms @ repo/issue_comment.go:110(repo.ListIssueCommentsAndTimeline), err=runtime error: invalid memory address or nil pointer dereference

Gitea Version

1.17.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?

Gitea binary, but this is the same on other instances too.

Database

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions