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

Use ParseStrict to be invalided ILOU characters #69 #119

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

u5surf
Copy link

@u5surf u5surf commented Apr 7, 2024

Fix #69

The rust ulid crate has no #69 ‘s issue below, that is why our golang's library should same condition for command to use ulid.ParseStrict by default.

crates: https://docs.rs/ulid/latest/ulid/
test code:

% cat ./src/main.rs 
use ulid::Ulid;

fn main() {
    let result1 = Ulid::from_string("0LLLLLLLLLLLLLLLLLLLLLLLLL");
    let result2 = Ulid::from_string("01111111111111111111111111");
    assert_eq!(result1, result2);
}

result

% ./target/debug/ulid-test
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `Err(InvalidChar)`,
 right: `Ok(Ulid(1372106318229590578481349223515194401))`', src/main.rs:6:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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.

ULIDs contains ILOU will be parsed as weird timestamps
1 participant