Fix createNote function to not duplicate /api/v4 in URL

This commit is contained in:
Admin
2025-03-17 14:22:37 -07:00
parent 0fd73ec04e
commit 4740a4b4f7
2 changed files with 6 additions and 0 deletions

View File

@ -345,8 +345,11 @@ async function updateMergeRequest(projectId, mergeRequestIid, options) {
async function createNote(projectId, noteableType, // 'issue' 또는 'merge_request' 타입 명시 async function createNote(projectId, noteableType, // 'issue' 또는 'merge_request' 타입 명시
noteableIid, body) { noteableIid, body) {
// ⚙️ 응답 타입은 GitLab API 문서에 따라 조정 가능 // ⚙️ 응답 타입은 GitLab API 문서에 따라 조정 가능
// Don't add /api/v4 again since it's already included in GITLAB_API_URL
const url = new URL(`${GITLAB_API_URL}/projects/${encodeURIComponent(projectId)}/${noteableType}s/${noteableIid}/notes` // Using plural form (issues/merge_requests) as per GitLab API documentation const url = new URL(`${GITLAB_API_URL}/projects/${encodeURIComponent(projectId)}/${noteableType}s/${noteableIid}/notes` // Using plural form (issues/merge_requests) as per GitLab API documentation
); );
// Add some debug logging
console.log(`DEBUG - createNote function called`);
console.log(`DEBUG - createNote - URL: ${url.toString()}`); console.log(`DEBUG - createNote - URL: ${url.toString()}`);
console.log(`DEBUG - createNote - projectId: ${projectId}, noteableType: ${noteableType}, noteableIid: ${noteableIid}`); console.log(`DEBUG - createNote - projectId: ${projectId}, noteableType: ${noteableType}, noteableIid: ${noteableIid}`);
console.log(`DEBUG - createNote - GITLAB_API_URL: ${GITLAB_API_URL}`); console.log(`DEBUG - createNote - GITLAB_API_URL: ${GITLAB_API_URL}`);

View File

@ -582,12 +582,15 @@ async function createNote(
body: string body: string
): Promise<any> { ): Promise<any> {
// ⚙️ 응답 타입은 GitLab API 문서에 따라 조정 가능 // ⚙️ 응답 타입은 GitLab API 문서에 따라 조정 가능
// Don't add /api/v4 again since it's already included in GITLAB_API_URL
const url = new URL( const url = new URL(
`${GITLAB_API_URL}/projects/${encodeURIComponent( `${GITLAB_API_URL}/projects/${encodeURIComponent(
projectId projectId
)}/${noteableType}s/${noteableIid}/notes` // Using plural form (issues/merge_requests) as per GitLab API documentation )}/${noteableType}s/${noteableIid}/notes` // Using plural form (issues/merge_requests) as per GitLab API documentation
); );
// Add some debug logging
console.log(`DEBUG - createNote function called`);
console.log(`DEBUG - createNote - URL: ${url.toString()}`); console.log(`DEBUG - createNote - URL: ${url.toString()}`);
console.log(`DEBUG - createNote - projectId: ${projectId}, noteableType: ${noteableType}, noteableIid: ${noteableIid}`); console.log(`DEBUG - createNote - projectId: ${projectId}, noteableType: ${noteableType}, noteableIid: ${noteableIid}`);
console.log(`DEBUG - createNote - GITLAB_API_URL: ${GITLAB_API_URL}`); console.log(`DEBUG - createNote - GITLAB_API_URL: ${GITLAB_API_URL}`);