Why do attachments have names like “PDF” or “Accepted Version” instead of their filenames in the items list?

Attachments have two separate names: the attachment title shown in the items list and the filename of the file on disk.

The file on disk is automatically renamed based on parent item metadata such as the title and authors, as explained above. Since the parent item row in the items list already displays that metadata, Zotero doesn't show the filename directly in the items list. Instead, it uses simpler attachment titles such as “PDF” or “Ebook” for the first file of a given type or includes additional information about the source of the file (e.g., “ScienceDirect Full Text PDF” for a file saved from ScienceDirect, or “Accepted Version” or “Submitted Version” for open-access files). These separate titles avoid cluttering the items list with duplicate metadata and prevent parent items from being unnecessarily expanded when searching for titles or creators.

Subsequent files added to an item from the filesystem will still get titles named after the filename (without the file extension), since those are likely to be supplementary files and the filename may be informative.

You can view and change the title and filename by clicking on the attachment and looking in the item pane.

Attachment Title Handling in Zotero 7

Zotero 7 makes a couple changes to how attachment titles are handled:

  1. Prior to Zotero 7, the attachment title was unnecessarily changed to the filename when manually running Rename File from Parent Metadata. This was a bug that led many people to believe that files weren't automatically renamed and it was necessary to run Rename File from Parent Metadata on every new attachment. The title is no longer changed, and titles remain as “PDF”, “ScienceDirect Full Text PDF”, or whatever they were set to previously.
  2. When dragging a file from the filesystem or creating a parent item, Zotero now sets the title of the first attachment of a given type to “PDF”, “EPUB”, etc., instead of setting the title based on the filename.

People who were unnecessarily running Rename File from Parent Metadata on every attachment or who were using the ZotFile plugin (which also set the title to the filename) might be used to seeing filenames in the items list, but we'd encourage people to give the new behavior a try.

If you'd like to convert existing attachments to use “PDF” titles for consistency, you can select all items in the items list, go to Tools → Developer → Run JavaScript, and run this code:

var items = ZoteroPane.getSelectedItems();
for (let item of items) {
    if (!item.isRegularItem()) continue;
    let attachment = await item.getBestAttachment();
    if (!attachment) continue;
    let title = attachment.getField('title');
    if (title.endsWith('.pdf')) {
        attachment.setField('title', 'PDF');
        await attachment.saveTx();
    }
}

This will go through the primary attachment of every selected item and convert the title of any that ends in “.pdf” to just “PDF”.

You should test with a smaller number of selected items first to make sure it's doing what you expect.

kb/attachment_title_vs_filename.txt · Last modified: 2024/09/10 16:41 by dstillman