Skip to content

fix: add articleId validation to avoid potential NPE in detail API#124

Open
Yummyyh wants to merge 1309 commits intoitwanger:mainfrom
Yummyyh:fix-id-validation
Open

fix: add articleId validation to avoid potential NPE in detail API#124
Yummyyh wants to merge 1309 commits intoitwanger:mainfrom
Yummyyh:fix-id-validation

Conversation

@Yummyyh
Copy link
Copy Markdown

@Yummyyh Yummyyh commented Dec 8, 2025

This PR adds input validation for articleId in the detail API of ArticleRestController.

Changes:

  • Added validation to ensure articleId is non-null and positive.
  • Prevents potential NullPointerException when articleService returns null or invalid data.
  • Improves API stability and aligns with common input validation best practices.

Effect:
This enhancement avoids unexpected runtime errors and makes the API more robust when receiving invalid client parameters.

itwanger and others added 29 commits November 3, 2025 15:34
Removed overflow and max-height from .widget in global.css and moved scroll and positioning logic to .column.toc-container in column-detail.css. Improved layout by making TOC container fixed, transparent, and properly layered, with internal widget styling for background and padding.
Refactored CSS and JS for article and column detail pages to resolve double scrollbar problems in the table of contents (TOC). Adjusted right margin from 310px to 300px for better alignment, improved TOC container and widget styles, and updated JS to simplify TOC line height and margin handling.
Adjusted the underline color, style, and thickness for highlighted comments and added a background color for selected text. Also updated the comment textarea placeholder to suggest mentioning AI assistants.
Renamed all references of '杠精机器人' to '杠精派' across backend, frontend, and database migration scripts. Updated NotifyService to support message types, refactored notification sending logic to use typed messages, and adjusted the WebSocket client to parse and handle typed notification payloads for improved notification categorization.
Introduces a commentId field to NotifyMsgDO, NotifyMsgDTO, and the notify_msg table to enable direct linking to specific comments in notifications. Updates the notification reply UI to link to the exact comment, and adjusts related SQL, XML, and template files. This improves user experience by allowing users to jump directly to the relevant comment from a notification.
Introduced Markdown rendering for comment content using marked.js with a fallback to basic rendering. Updated comment HTML templates to support rendered HTML, added corresponding CSS styles, and included the new JS logic for dynamic and static comment rendering. Also adjusted the article detail page to load the required scripts and styles.
Introduced a floating comment button with a badge showing the comment count on article detail pages. Updated CSS for interactive button effects and badge display, and adjusted the share button style for consistency. Also refactored modal markup in column detail view for improved structure.
Moved quote comment and markdown-related CSS from article-detail.css and column-detail.css into global.css for reuse. Added marked.js and comment-markdown.js scripts to column-detail page to enable markdown rendering in comments. Updated share button logic in toolaction.js to require login before sharing.
Deleted redundant z-index: 1 declarations from .article-detail and .column-detail classes to simplify CSS and avoid potential stacking context issues.
Add urlSlug support across article models, services, and controllers to enable SEO-friendly URLs. Update sitemap generation, article publishing, and admin interfaces to use and manage slugs. Include migration scripts and admin endpoints for slug backfilling. Update frontend templates and redirect logic to support new URL formats while maintaining backward compatibility.
Introduces a GEMINI.md file with an overview of the Java-based community system, build and run instructions, development conventions, and configuration details for contributors and users.
Refactored sitemap URL generation to prioritize column URLs for articles with short titles and added fallback logic. Updated article detail page UI text for locked content to provide clearer instructions.
Changed AI bot avatar URLs to local static paths and added logic in AiBotService to ensure user avatars are updated if the config changes. Added the itwanger.jpg avatar image to the static resources. No functional changes to database schema update script.
Introduced SlugGeneratorService to generate SEO-friendly URL slugs using AI integrations. Updated ArticleSettingServiceImpl to use the new service for slug creation when not provided by the user. Removed legacy slug logic from ArticleConverter. Added unit tests for slug generation.
LoginServiceImpl now checks if the current user already owns the star number before throwing a repeat binding exception. The navbar.html template adds a 'Return to Login' link for improved navigation in the login modal.
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.

7 participants