From 889f64009b3208c701ce96093486294fc4934714 Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Sun, 31 May 2026 11:12:44 -0500 Subject: [PATCH] =?UTF-8?q?fix:=20resolve=20tech-debt=20batch=204=20?= =?UTF-8?q?=E2=80=94=20parseIssueHref,=20job=20limit,=20stale=20TODOs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - fix(ts): parseIssueHref now uses URL pathname and trims appSubUrl for correct issue link parsing with sub-path deployments - fix(actions): enforce MaxJobNumPerRun (256) limit when creating jobs, rejecting workflows that exceed the GitHub-compatible limit - chore: remove stale TODO comment on OAuth redirect route Refs #325, #334 Co-Authored-By: Claude Opus 4.6 (1M context) --- models/actions/run_job.go | 1 - routers/web/web.go | 1 - services/actions/run.go | 4 ++++ web_src/js/utils.ts | 8 +++++--- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/models/actions/run_job.go b/models/actions/run_job.go index d12748d554..93097cc449 100644 --- a/models/actions/run_job.go +++ b/models/actions/run_job.go @@ -20,7 +20,6 @@ import ( // MaxJobNumPerRun is the maximum number of jobs in a single run. // https://docs.github.com/en/actions/reference/limits#existing-system-limits -// TODO: check this limit when creating jobs const MaxJobNumPerRun = 256 // ActionRunJob represents a job of a run diff --git a/routers/web/web.go b/routers/web/web.go index 342c851f58..34164528f9 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -595,7 +595,6 @@ func registerWebRoutes(m *web.Router, webAuth *AuthMiddleware) { m.Group("", func() { m.Get("/authorize", web.Bind(forms.AuthorizationForm{}), auth.AuthorizeOAuth) m.Post("/grant", web.Bind(forms.GrantApplicationForm{}), auth.GrantApplicationOAuth) - // TODO manage redirection m.Post("/authorize", web.Bind(forms.AuthorizationForm{}), auth.AuthorizeOAuth) }, reqSignIn) diff --git a/services/actions/run.go b/services/actions/run.go index 82c9b17aec..6151ca3905 100644 --- a/services/actions/run.go +++ b/services/actions/run.go @@ -82,6 +82,10 @@ func InsertRun(ctx context.Context, run *actions_model.ActionRun, content []byte return fmt.Errorf("parse workflow: %w", err) } + if len(jobs) > actions_model.MaxJobNumPerRun { + return fmt.Errorf("workflow has too many jobs (%d), maximum is %d", len(jobs), actions_model.MaxJobNumPerRun) + } + titleChanged := len(jobs) > 0 && jobs[0].RunName != "" if titleChanged { run.Title = util.EllipsisDisplayString(jobs[0].RunName, 255) diff --git a/web_src/js/utils.ts b/web_src/js/utils.ts index feeb4d3b6b..45a39ef85e 100644 --- a/web_src/js/utils.ts +++ b/web_src/js/utils.ts @@ -52,9 +52,11 @@ export function stripTags(text: string): string { } export function parseIssueHref(href: string): IssuePathInfo { - // FIXME: it should use pathname and trim the appSubUrl ahead - const path = (href || '').replace(/[#?].*$/, ''); - const [_, ownerName, repoName, pathType, indexString] = /([^/]+)\/([^/]+)\/(issues|pulls)\/([0-9]+)/.exec(path) || []; + let pathname = href || ''; + try { pathname = new URL(pathname, window.location.origin).pathname } catch {} + const appSubUrl = window.config.appSubUrl; + if (appSubUrl && pathname.startsWith(appSubUrl)) pathname = pathname.substring(appSubUrl.length); + const [_, ownerName, repoName, pathType, indexString] = /([^/]+)\/([^/]+)\/(issues|pulls)\/([0-9]+)/.exec(pathname) || []; return {ownerName, repoName, pathType, indexString}; } -- 2.52.0