export function parseIssueUrl()

in src/ui/utils/gitlab_utils.js [33:54]


export function parseIssueUrl(issueUrl) {
  let url;
  try {
    url = new URL(issueUrl);
  } catch (e) {
    return {};
  }

  // if (url.protocol !== GITLAB_INSTANCE_PROTOCOL || url.hostname !== GITLAB_INSTANCE_HOSTNAME) {
  if (url.protocol !== GITLAB_INSTANCE_PROTOCOL) {
    return {};
  }

  const match = url.pathname.match(GITLAB_ISSUE_URL_REGEX);
  if (!match) return {};

  const [, projectPath, issueId] = match;
  return {
    projectPath,
    issueId,
  };
}