Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: type cast empty array to fix a typescript error #382

Merged
merged 2 commits into from
Jan 23, 2023

Conversation

wolfy1339
Copy link
Member

@wolfy1339 wolfy1339 commented Dec 7, 2022

See #379, the tests are failing due to an error with typescript


Behavior

Before the change?

  • The array was typed as never[]

After the change?

  • The array is now correctly types

Other information


Additional info

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Added the appropriate label for the given change

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes (Please add the Type: Breaking change label)
  • No

If Yes, what's the impact:

  • N/A

Pull request type

Please add the corresponding label for change this PR introduces:

  • Bugfix: Type: Bug
  • Feature/model/API additions: Type: Feature
  • Updates to docs or samples: Type: Documentation
  • Dependencies/code cleanup: Type: Maintenance

@wolfy1339 wolfy1339 added the Type: Bug Something isn't working as documented label Dec 7, 2022
src/parse.ts Fixed Show fixed Hide fixed
@@ -58,7 +58,7 @@

if (options.mediaType.previews.length) {
const previewsFromAcceptHeader =
headers.accept.match(/[\w-]+(?=-preview)/g) || [];
headers.accept.match(/[\w-]+(?=-preview)/g) || ([] as string[]);

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data

This [regular expression](1) that depends on [library input](2) may run slow on strings with many repetitions of '-'.
@nickfloyd
Copy link
Contributor

Hey @wolfy1339 I removed the concept of previews from the GitHub REST API a little over a year ago in preparation for REST API versioning, which, I believe, makes this logic obsolete. Unfortunately, I have yet to have time to document and change all of the implementations in our SDKs.

As a side note, the last "supported" version of GHES (enterprise server) is 3.3, which will EOL on 2023-01-18. This would be a great opportunity for us to clean our preview house.

Let me know if you think the logic around the changeset is still necessary.

Copy link
Contributor

@nickfloyd nickfloyd left a comment

Choose a reason for hiding this comment

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

Thanks for this change @wolfy1339 ❤️

@nickfloyd nickfloyd merged commit 90b6705 into main Jan 23, 2023
@nickfloyd nickfloyd deleted the wolfy1339-patch-1 branch January 23, 2023 22:52
@github-actions
Copy link

🎉 This PR is included in version 7.0.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions
Copy link

🎉 This issue has been resolved in version 8.0.0-beta.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released on @beta released Type: Bug Something isn't working as documented
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants