Skip to content

refactor(server): parsepackagestring called on potentially undefined packagequery#974

Open
LucciHank wants to merge 1 commit intopastelsky:bundlephobiafrom
LucciHank:contribai/improve/quality/parsepackagestring-called-on-potentially
Open

refactor(server): parsepackagestring called on potentially undefined packagequery#974
LucciHank wants to merge 1 commit intopastelsky:bundlephobiafrom
LucciHank:contribai/improve/quality/parsepackagestring-called-on-potentially

Conversation

@LucciHank
Copy link
Copy Markdown

Description

ctx.query.package can be undefined (missing query param). Passing it to parsePackageString does packageString.lastIndexOf which throws TypeError. The line is outside any try/catch and after the build, so the whole request fails. Identical code exists in exports.middleware.js.

Changes

  • server/middlewares/exportsSizes.middleware.js (modified)

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Testing

  • Code follows the style guidelines of this project
  • Self-review of code completed
  • Changes generate no new warnings
  • Corresponding changes to documentation made (if applicable)

Severity: high

Contributed by Lê Thành Chỉnh
Code is a tool. Mindset is the real value.

Closes #973

…uery

ctx.query.package can be undefined (missing query param). Passing it to parsePackageString does `packageString.lastIndexOf` which throws TypeError. The line is outside any try/catch and after the build, so the whole request fails. Identical code exists in exports.middleware.js.

Affected files: exportsSizes.middleware.js

Signed-off-by: Hoangg Anh <131897682+LucciHank@users.noreply.github.com>
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.

fix: parsepackagestring called on potentially undefined packagequery

1 participant