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: fixed a bug in new_strings #45

Merged
merged 3 commits into from
Jul 29, 2022
Merged

fix: fixed a bug in new_strings #45

merged 3 commits into from
Jul 29, 2022

Conversation

swanandx
Copy link
Collaborator

@swanandx swanandx commented Jul 28, 2022

The bug was caused by reassigning new_strings inside a try_for_each block.

new_strings = results_vec
        .into_iter()
        .flat_map(|r| r.unencrypted_text)
        .filter(|s| seen_strings.insert(s.clone()))
        .collect();

This was overwriting the content of new_strings with the strings from result_vec of the last result it got from running decoders. This isn't intended. we want strings from all results.

Therefore, we use .extend to extend our new_strings with the strings from each result_vec

new_strings.extend(
        results_vec
            .into_iter()
            .flat_map(|r| r.unencrypted_text)
            .filter(|s| seen_strings.insert(s.clone())),
    );

Link to Discussion

@bee-san
Copy link
Owner

bee-san commented Jul 28, 2022

Can we add a test for this at all?

@bee-san bee-san merged commit cb93397 into main Jul 29, 2022
@delete-merged-branch delete-merged-branch bot deleted the swan-fix branch July 29, 2022 06:53
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