Skip to content

Allow automatic extraction of lid from List-Id header#241

Open
sbp wants to merge 1 commit into
apache:masterfrom
sbp:automatic-lid
Open

Allow automatic extraction of lid from List-Id header#241
sbp wants to merge 1 commit into
apache:masterfrom
sbp:automatic-lid

Conversation

@sbp

@sbp sbp commented Jun 15, 2022

Copy link
Copy Markdown
Contributor

This PR means that you can run python3 dkim_id.py example.eml - and the lid is automatically extracted from the List-Id header, if present, without incurring the bug in #113.

@sbp sbp force-pushed the automatic-lid branch from c8f2b9c to 177a4f8 Compare June 15, 2022 21:01
@sebbASF

sebbASF commented Jun 15, 2022

Copy link
Copy Markdown
Contributor

However fixing the bug will effectively change the generate ids.

@sbp

sbp commented Jun 15, 2022

Copy link
Copy Markdown
Contributor Author

This doesn't fix the bug. The bug is still present, unless the new automatic argument is set to True. The intended use is for parsing messages from the command line.

@sebbASF sebbASF left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also I think there needs to be a test to show that the generated id is the same whether automatic mode is used or the lid is provided

Comment thread tools/plugins/dkim_id.py
elif len(argv) == 3: # add lid
lid: Optional[bytes] = argv[2].encode("utf-8")
automatic: bool = False
if lid == b"-":

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This special value needs documenting

Comment thread tools/plugins/dkim_id.py
head_canon: bool = False,
body_canon: bool = False,
lid: Optional[bytes] = None,
automatic: bool = False,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Needs documenting

Comment thread tools/plugins/dkim_id.py
data: bytes, lid: Optional[bytes] = None
data: bytes,
lid: Optional[bytes] = None,
automatic: bool = False,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Needs documenting

Comment thread tools/plugins/dkim_id.py

def dkim_id(data: bytes, lid: Optional[bytes] = None) -> str:
def dkim_id(
data: bytes, lid: Optional[bytes] = None, automatic: bool = False

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

automatic arg needs documenting

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