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

add numeric icon feature #762

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

add numeric icon feature #762

wants to merge 9 commits into from

Conversation

dkuntze
Copy link
Collaborator

@dkuntze dkuntze commented Dec 2, 2024

Please ensure your pull request adheres to the following guidelines:

  • make sure to link the related issues in this description
  • when merging / squashing, make sure the fixed issue references are visible in the commits, for easy compilation of release notes

This PR expands the ability to have numbers in icon names while keeping existing functionality. It does fail the regex vulnerability check at https://devina.io/redos-checker (but so does the existing). Will look at seeing if its possible to refactor to make it free of vulnerabilities by making this a tokenizer statemachine.

Related Issues

Thanks for contributing!

@dkuntze dkuntze requested a review from tripodsan December 2, 2024 16:03
@dkuntze dkuntze marked this pull request as ready for review December 2, 2024 16:03
Copy link
Contributor

@tripodsan tripodsan left a comment

Choose a reason for hiding this comment

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

sorry, but we need to do a full scan of all content of all customers in order to judge the scope of this change. the last time, we created a CSO with exactly this kind of fix.

@alexcarol
Copy link

This will also be useful for the ESRI project, thanks @dkuntze!

@dkuntze dkuntze self-assigned this Feb 6, 2025
@bstopp
Copy link

bstopp commented Feb 7, 2025

Running into same issue w/ Jet2.

This successfully gets converted into an icon: :Jet2Holidays:

This does not: :Jet2holidays-no-strapline:

Both should work. Checked the proposed regex, worked as expected.

@tripodsan
Copy link
Contributor

tripodsan commented Feb 11, 2025

here some false positives that were found scanning the content:

  • g) and 1:00-3:00 PM. H
  • 6:00AM-6:00 PM MT
  • 11:30am-12:30pm CT
  • c HEVC 4:2:2 10 bit
  • 色情報が半分の4:2:2素材では、エッ
  • 月1日木曜日14:00-19:00
  • Sec4:3-Sec4:6, Sec3:
  • ben Sie :1: ein, ge
  • 168.0.52:4501:ssl
  • YYYY-MM-DDTHH:mm:ss.sssZ

@dkuntze
Copy link
Collaborator Author

dkuntze commented Feb 11, 2025

I'm starting to think this is an impossible task. I may just document what works and what doesn't and call it a day.

Copy link

This PR will trigger no release when merged.

Copy link

codecov bot commented Feb 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (a1e2e51) to head (19e2085).
Report is 46 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##              main      #762    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           45        46     +1     
  Lines         3641      3979   +338     
==========================================
+ Hits          3641      3979   +338     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dkuntze
Copy link
Collaborator Author

dkuntze commented Feb 11, 2025

@tripodsan I gave it another go and added your false positives to the tests


// Skip if this looks like part of a pattern
if (/[\d:T]/.test(beforeChar) || /[\d:]/.test(afterChar)) {
return idx + 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

what about the rest of the text? eg 00:00:00 and :icon: ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

should :icon: be ignored?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added tests for :icon: to work (literal) and 00:00:00 to fail.

Both are working.

Copy link
Contributor

@tripodsan tripodsan Feb 12, 2025

Choose a reason for hiding this comment

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

I mean, the return here aborts the for loop over all matches. so for the pattern :foo:2 and :icon: the icon is not replaced. I'll add the test

Copy link
Contributor

Choose a reason for hiding this comment

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

als I don't think that :icon:2 should be ignored should be ignored.

Copy link
Contributor

@tripodsan tripodsan left a comment

Choose a reason for hiding this comment

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

not quite, I think.

@dkuntze dkuntze requested a review from tripodsan February 11, 2025 21:27
Copy link
Contributor

@tripodsan tripodsan left a comment

Choose a reason for hiding this comment

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

I appreciate the effort, but this is getting too complicated and potentially a performance drain. I think the previous iteration was ok, besides the return at the wrong place.

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.

4 participants