Zotero 7: PDF file not renaming in UI

When you have an existing item in Zotero and then drag a PDF onto it, the PDF name doesn't change. The PDF name in the UI also doesn't change when you explicitly do a "Rename from parent metadata" from the menu.

It appears as though it's just a UI thing as the physical file has changed name (see attached image)

https://s3.amazonaws.com/zotero.org/images/forums/u5869622/kczh7giozr3yqo4lsoyi.png
  • Ahhh so this is expected behaviour. Thank you.

    Is there a way to update previous attachment titles to make things consistent (or would this be "dangerous")?
  • Not currently a built-in way, but easy enough to do. Select all items in the items list, go to Tools → Developer → Run JavaScript, and run this:

    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 can test with a smaller number of selected items first to make sure it's doing what you expect.
  • Excellent. Thank you once again
Sign In or Register to comment.