Skip to content

feat: 更新references、related_works字段#430

Merged
shijinpjlab merged 1 commit into
MigoXLab:devfrom
shijinpjlab:dev_sj_0612
Jun 12, 2026
Merged

feat: 更新references、related_works字段#430
shijinpjlab merged 1 commit into
MigoXLab:devfrom
shijinpjlab:dev_sj_0612

Conversation

@shijinpjlab

Copy link
Copy Markdown
Collaborator

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the validation logic for references, related works, and citations by consolidating them into a single helper function, _check_id_type_id_title_items. However, this change inadvertently removes the URL format validation (using URL_RE) that was previously applied to references and related works. It is recommended to restore this validation within the helper function when the id_type is set to 'url'.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.


def check_citations(citations: Any) -> bool:
if citations is None:
def _check_id_type_id_title_items(items: Any) -> bool:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

在重构 check_referencescheck_related_works 之后,它们现在统一使用 _check_id_type_id_title_items 函数进行校验。\n\n然而,原先的实现中,referencesrelated_works 中的每个元素都必须是符合 URL_RE 的有效 URL。在新的实现中,如果 id_type"url",代码仅校验了 citation_id 是否为非空字符串,而没有使用 URL_RE 进行格式校验。这会导致 URL 格式校验失效(任何非空字符串都会被视为有效的 URL)。\n\n建议在 _check_id_type_id_title_items 中增加对 id_type == "url" 的校验,例如:\n\npython\n if id_type == "doi":\n if check_doi(citation_id, "paper"):\n return True\n elif id_type == "url":\n if not isinstance(citation_id, str) or not URL_RE.fullmatch(citation_id):\n return True\n elif not isinstance(citation_id, str) or citation_id == "":\n return True\n

@shijinpjlab shijinpjlab merged commit 62c1454 into MigoXLab:dev Jun 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant