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 link regex #922

Merged
merged 4 commits into from
Oct 7, 2024
Merged

Fix link regex #922

merged 4 commits into from
Oct 7, 2024

Conversation

mattwiebe
Copy link
Contributor

We are getting a bunch of errors like this on wpcom:

Warning: Undefined array key "host" in /wp-content/plugins/activitypub/dev/includes/class-link.php on line 84

This is because the previous regex was matching a string like www foo when it shouldn't be. I don't understand why the previous negated character class didn't work, but using the \S class is equivalent to ^\s. I simplified the https? match a bit while I was in there.

Proposed changes:

  • improve ACTIVITYPUB_URL_REGEXP

Other information:

  • Have you written new tests for your changes, if applicable?

Testing instructions:

  • Go to '..'

Copy link
Member

@pfefferle pfefferle left a comment

Choose a reason for hiding this comment

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

@mattwiebe can you add the false positives to the test case?

@mattwiebe
Copy link
Contributor Author

@mattwiebe can you add the false positives to the test case?

Will do! Having a little trouble with the tests (again) but I'll circle back with fresh energy tomorrow

@pfefferle pfefferle merged commit 0625090 into trunk Oct 7, 2024
21 checks passed
@pfefferle pfefferle deleted the fix/undefined-array-key-host branch October 7, 2024 11:25
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