core: percent decode filename

* src/op-support.c (_gpgme_parse_plaintext): Decode filename
as percent string.

--
From gnupg/doc/DETAILS:

    If a filename is available it gets printed as the third
    argument, percent-escaped as usual.

so we can use the usual percent decode function here.

GnuPG-Bug-Id: T6852
This commit is contained in:
Andre Heinecke 2023-11-30 00:06:08 +01:00
parent f212de4a9e
commit 6baccdc0c3
No known key found for this signature in database
GPG Key ID: 2978E9D40CBABA5C

View File

@ -388,9 +388,12 @@ _gpgme_parse_plaintext (char *args, char **filenamep, int *r_mime)
*tail = '\0'; *tail = '\0';
if (filenamep && *args != '\0') if (filenamep && *args != '\0')
{ {
char *filename = strdup (args); gpgme_error_t err = 0;
if (!filename) char *filename = NULL;
return gpg_error_from_syserror ();
err = _gpgme_decode_percent_string (args, &filename, 0, 0);
if (err)
return err;
*filenamep = filename; *filenamep = filename;
} }