mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-23 02:36:05 +00:00
fix: extract numeric issue ID from malformed GitLab issue IDs
- Fixed issue where issueId contained full project path like 'project/repo#4' instead of just '4' - Added regex to extract numeric ID from formats like 'project/repo#123' or '#123' - This resolves URLs being constructed as 'gitlab.com/project/-/issues/project/repo#4' - Now correctly constructs 'gitlab.com/project/-/issues/4' - Kept debug logging to verify the fix works 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
8a03471f82
commit
0e557afec7
1 changed files with 10 additions and 4 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { Injectable, inject } from '@angular/core';
|
||||
import { inject, Injectable } from '@angular/core';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { Task } from 'src/app/features/tasks/task.model';
|
||||
import { concatMap, first, map, switchMap } from 'rxjs/operators';
|
||||
|
|
@ -42,20 +42,26 @@ export class GitlabCommonInterfacesService implements IssueServiceInterface {
|
|||
.pipe(
|
||||
map((cfg) => {
|
||||
const project: string = cfg.project;
|
||||
|
||||
// Extract just the numeric issue ID from formats like 'project/repo#123' or '#123'
|
||||
const cleanIssueId = issueId.toString().replace(/^.*#/, '');
|
||||
|
||||
console.log('GitLab issueLink debug:', {
|
||||
issueId,
|
||||
originalIssueId: issueId,
|
||||
cleanIssueId,
|
||||
project,
|
||||
gitlabBaseUrl: cfg.gitlabBaseUrl,
|
||||
});
|
||||
|
||||
if (cfg.gitlabBaseUrl) {
|
||||
const fixedUrl = cfg.gitlabBaseUrl.match(/.*\/$/)
|
||||
? cfg.gitlabBaseUrl
|
||||
: `${cfg.gitlabBaseUrl}/`;
|
||||
const url = `${fixedUrl}${project}/-/issues/${issueId}`;
|
||||
const url = `${fixedUrl}${project}/-/issues/${cleanIssueId}`;
|
||||
console.log('GitLab issueLink result (custom base):', url);
|
||||
return url;
|
||||
} else {
|
||||
const url = `${GITLAB_BASE_URL}${project}/-/issues/${issueId}`;
|
||||
const url = `${GITLAB_BASE_URL}${project}/-/issues/${cleanIssueId}`;
|
||||
console.log('GitLab issueLink result (default base):', url);
|
||||
return url;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue