GpgOL: Temp filename creation fails to choose proper extension
Closed, ResolvedPublic

Assigned To
Authored By
mmontkowski
Jul 14 2025, 4:39 PM

Description

The get_tmp_outfile chooses everthing after the first "." as extension. It should choose everting after the last "."

Filename: "Report of meeting 02.04.25 regarding something.doc"
IS => Extension : "04.25 regarding something.doc"
SHOULD => "doc"

If the filename is very long and the dot early in the filename the temp filename could be longer than MAX_PATH.

Revisions and Commits

Event Timeline

mmontkowski created this task.
mmontkowski changed the task status from Open to Testing.Jul 14 2025, 4:48 PM
mmontkowski moved this task from Backlog to WIP on the gpgol board.
mmontkowski moved this task from Backlog to WiP on the vsd33 board.
• ebo moved this task from Backlog to WIP on the gpd5x board.
• ebo renamed this task from Temp filename creation fails to choose proper extension to GpgOL: Temp filename creation fails to choose proper extension.Aug 5 2025, 9:09 AM

How to test this? The follwing happens for an attachment of an encrypted mail on gpg4win-5.0.0-beta357, Outlook LTSC Standard 2024 @ win10:

  • Original filename with max length: long.filename.with.some.dots.in.it.long.filename.with.some.dots.in.it.long.filename.with.some.dots.in.it.long.filename.with.some.dots.in.it.long.filename.with.some.dots.in.it.long.filename.max.symmetric_encryption_gnupg_de.odt
  • Both displayed and downloaded filename is the same as the original one
  • Temporary filenames in C:\Users\g10\AppData\Local\Microsoft\Windows\INetCache\Content.Outlook are
    • long.filename.with.some.dots.in.it.long.filename.with.some.dots.in.it.long.filename.with.some.dots.in.it.long.filename.with.some.dots.in.it.long.filename.with.some.dots.odt
    • long.filename.with.some.dots.in.it.long.filename.with.some.dots.in.it.long.filename.with.some.dots.in.it.long.filename.with.some.dots.in.it.long.filename.with.some.dots (002).odt

Sorry, I just found out, that windows caps the filename earlier than max length, so my former tests were invalid.

I retried with the filename 123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.1.odt and the temporary filename is now attachment.odt or e.g. attachment (002).odt.

Possible improvements:

  • Use original filename on save (attachment.odt)
  • Use original filename on open

But as those long filenames are an edge case, I think it's ok. In any case, the extraction of the extension does now work now as intended, so I set this to done.

mmontkowski mentioned this in Unknown Object (Maniphest Task).Sep 22 2025, 10:11 AM

Looks good to me on vsd-3.3.3-beta90.12 @ win10 (temporary filename is now attachment.odt or e.g. attachment (002).odt)

timegrid edited projects, added vsd33 (vsd-3.3.3); removed vsd33.
timegrid claimed this task.
• ebo mentioned this in Unknown Object (Maniphest Task).Mar 31 2026, 1:10 PM