Skip to content

[FIX] dms: use _slugify for subject in directory message_new#492

Merged
OCA-git-bot merged 1 commit into
OCA:18.0from
mmircoli-nexapp:18.0-fix-dms-directory-alias-slug
Jun 23, 2026
Merged

[FIX] dms: use _slugify for subject in directory message_new#492
OCA-git-bot merged 1 commit into
OCA:18.0from
mmircoli-nexapp:18.0-fix-dms-directory-alias-slug

Conversation

@mmircoli-nexapp

Copy link
Copy Markdown
Contributor

Fixes #491.

Problem

Incoming emails routed to a dms.directory alias configured with Unpack Emails as: Subdirectory (alias_process = 'directory', the default) crash in message_new:

ValueError: too many values to unpack (expected 2)

message_new calls ir.http._slug() on the subject string, but _slug() expects a recordset or a (id, name) tuple, not a plain string.

Fix

Use ir.http._slugify() — the helper meant to slugify a plain string — to build the subdirectory name from the email subject.

Test

Verified manually: routing an email (with an attachment) to the directory alias now creates the expected subdirectory, named after the slugified subject, with the attachment stored as a dms.file. Happy to add an automated regression test under dms/tests/ if reviewers prefer.

When an incoming email is processed for a dms.directory alias configured
with "Unpack Emails as: Subdirectory" (alias_process='directory'),
message_new() builds the new subdirectory name from the email subject by
calling ir.http._slug() on a plain string. _slug() expects a record or a
(id, name) tuple, so it raises:

    ValueError: too many values to unpack (expected 2)

and the incoming email cannot be ingested. The intent is simply to
slugify the subject string, which is what ir.http._slugify() does.
Use it instead.
@pedrobaeza

Copy link
Copy Markdown
Member

Next time, put directly the PR with the issue explanation, without the GitHub issue.

@pedrobaeza pedrobaeza added this to the 18.0 milestone Jun 23, 2026
@pedrobaeza pedrobaeza requested a review from victoralmau June 23, 2026 08:13
@pedrobaeza

Copy link
Copy Markdown
Member

/ocabot merge patch

@OCA-git-bot

Copy link
Copy Markdown
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 18.0-ocabot-merge-pr-492-by-pedrobaeza-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 8cae392 into OCA:18.0 Jun 23, 2026
6 of 7 checks passed
@OCA-git-bot

Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at c8d31ce. Thanks a lot for contributing to OCA. ❤️

@mmircoli-nexapp mmircoli-nexapp deleted the 18.0-fix-dms-directory-alias-slug branch June 23, 2026 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dms: incoming email to directory alias crashes in message_new (_slug misused on subject string)

4 participants