From d90b01dbfd723c20aa61f692001d146d49d0324b Mon Sep 17 00:00:00 2001 From: Tigran Aivazian Date: Wed, 24 Oct 2012 14:13:12 +0100 Subject: [PATCH] Handle absolute attachment pathnames We must use only the basename part of the embedded attachment filename, because the directories used in the path on the machine where the attachments were created may not even exist on the machine where they are extracted. --- extr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extr.c b/extr.c index 2bd69e4dc..c73f86ce5 100644 --- a/extr.c +++ b/extr.c @@ -50,7 +50,7 @@ int save_attachments(int pageno, char *targetdir) pdf_obj *fs_obj = pdf_dict_gets(annot->obj, "FS"); if (fs_obj) { pdf_obj *ef_obj; - char *name = pdf_to_str_buf(pdf_dict_gets(fs_obj, "F")); + char *name = basename(strdup(pdf_to_str_buf(pdf_dict_gets(fs_obj, "F")))); ef_obj = pdf_dict_gets(fs_obj, "EF"); if (ef_obj) { pdf_obj *f_obj = pdf_dict_gets(ef_obj, "F");