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

utils: Include query parameters in matchDiscord function #145

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

prgmitchell
Copy link
Member

@prgmitchell prgmitchell commented Feb 19, 2024

Description

Modify the regular expression for the matchDiscord function to include the query parameters which the Discord API expects.

Motivation and Context

Saw logs failing to parse with a "NO LOG" error in the Discord server.

How Has This Been Tested?

Testing with this log URL: https://cdn.discordapp.com/attachments/355827402561159178/1217544190716805302/2024-03-12_22-41-48.txt?ex=66046963&is=65f1f463&hm=1044577dc373af1519f996eb78e3a96fe94ccd6c4e19dd8437f8ce953eec7222&

Previously only 374636015396192257/1209173862395420702/2024-02-17_18-25-28.txt was being matched which resulted in a 403 response when using the Discord API. Now the full query is matched and passed through to the API.

Before:
Screenshot 2024-02-19 at 12 44 33 PM

After:
Screenshot 2024-02-19 at 12 45 05 PM

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@RytoEX
Copy link
Member

RytoEX commented Mar 13, 2024

Testing this regex string at regex101, it seems the current regex matches the example URL just fine.
image

I'm confused what is actually supposed to fail.

@RytoEX
Copy link
Member

RytoEX commented Mar 13, 2024

Also, visiting the sample URL results in a 404:

This content is no longer available.

@prgmitchell
Copy link
Member Author

We talked off thread but I am posting here in case anyone looks, Discord URL is updated in the PR...not sure how long they are valid before Discord expires them though.

Copy link
Member

@RytoEX RytoEX left a comment

Choose a reason for hiding this comment

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

I've given a suggestion on restricting the scope of the modified regex. Please let me know if there are additional patterns that must be matched that would not fit this suggestion.

checks/utils/fetchers.py Outdated Show resolved Hide resolved
Modify the regular expression for the matchDiscord function to include
 the query parameters which the Discord API expects.
@prgmitchell
Copy link
Member Author

prgmitchell commented Mar 15, 2024

I've given a suggestion on restricting the scope of the modified regex. Please let me know if there are additional patterns that must be matched that would not fit this suggestion.

I updated this, it works with all the example links I could find but I will not pretend to be an expert in the links Discord spits out or regular expressions so I am happy to defer to your judgement on this.

@RytoEX RytoEX self-assigned this Mar 15, 2024
@RytoEX RytoEX merged commit 56d2c0d into obsproject:master Mar 15, 2024
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.

2 participants