Skip to content

Commit

Permalink
Fix crash when GitLab commit author is null (#318)
Browse files Browse the repository at this point in the history
  • Loading branch information
DucLongHoang authored Feb 2, 2025
1 parent 3179e74 commit c59de02
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/lib/services/backends/gitlab.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ const fetchFileContents = async (fetchingFiles) => {

/**
* @type {{
* author: { id?: string, username?: string },
* author: { id?: string, username?: string } | null,
* authorName: string, authorEmail: string, committedDate: string
* }[]}
*/
Expand All @@ -508,7 +508,7 @@ const fetchFileContents = async (fetchingFiles) => {
const result = //
/**
* @type {{ project: { repository: { [tree_index: string]: { lastCommit: {
* author: { id?: string, username?: string },
* author: { id?: string, username?: string } | null,
* authorName: string, authorEmail: string, committedDate: string
* } } } } } }}
*/ (
Expand Down Expand Up @@ -563,13 +563,8 @@ const fetchFileContents = async (fetchingFiles) => {
};

if (commit) {
const {
author: { id, username },
authorName,
authorEmail,
committedDate,
} = commit;

const { author, authorName, authorEmail, committedDate } = commit;
const { id, username } = author ?? {};
const idMatcher = id?.match(/\d+/);

data.meta = {
Expand Down

0 comments on commit c59de02

Please sign in to comment.