Skip to content

Conversation

@cenavarro
Copy link
Contributor

Hi,

When using PDF417.encode or PDF417.encode_to_base64 with a string that starts with a number and is greater than 13 digits, the NumberCompactor.compactable? is returning true due to Integer.parse(part) returning an output like {number, rest of string}

i.e a string like 74cLlWZPjVWX02 when calling Integer.parse("74cLlWZPjVWX02") it returns {74, "cLlWZPjVWX02"} and then later when using String.to_integer() in the def compact(part) function, it raises an error 1st argument: not a textual representation of an integer because it is not a string integer representation.

Instead of using Integer.parse, we can use a regex to only accept strings with numbers (string integer representation)

@cenavarro cenavarro changed the title fix: Fixes an issue with NumberCompactor.compactable? when the string is not a number representation fix: Fixes an issue with strings that starts with numbers Feb 20, 2025
@photomattmills
Copy link
Contributor

This is a good catch! Let me see if I can get the CI working, you might need to rebase that once it's up.

@photomattmills
Copy link
Contributor

CI should work if you rebase on main now, and then we can get this merged and released. Thanks again!

@cenavarro
Copy link
Contributor Author

Hi @photomattmills,

I rebased the main branch and pushed the changes again.

@photomattmills photomattmills merged commit ecf39c0 into jackpocket:main Feb 26, 2025
1 check 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