Rename File Bug?
https://s3.amazonaws.com/zotero.org/images/forums/u84240/24fxa3y0d1ayoqyg8w1n.png
Rename File from Parent Metadata renames the file on the hard drive but not in the attachment name in the reference in Z7 UI.
https://s3.amazonaws.com/zotero.org/images/forums/u84240/7qjp8zopn1t4iucs5i91.png
https://s3.amazonaws.com/zotero.org/images/forums/u84240/oc9knv7fwjecba810m31.png
Not sure about this, why not just show an icon then for the file type and file number? One more thing to edit...
Also, how do I edit the name of the attachment rather than the file? Not in the right click where one would expect it and not in the panel.
So, after I add the second and remove the first I have this and cannot change?
https://s3.amazonaws.com/zotero.org/images/forums/u84240/6uyp2hyxq5kgn54ogyxs.png
And all Z6 attachment will use file names and cannot be conformed to the new approach?
With my deficiencies, I might still be missing things.
More generally:
https://s3.amazonaws.com/zotero.org/images/forums/u11839746/31td6f12ly8cwzv27qfk.png
"The parent item row already displays metadata such as the title and authors, and since files are generally renamed using that same 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."
So this is a new feature that is different from zotero6.
https://www.zotero.org/support/file_renaming#attachment_title_handling_in_zotero_7
It's also a bit odd to me that additional files of a given type get their filenames as titles. If that's the case, why not do the same with the first one?
Finally I like to see the filename as well, so that when I open it in an external viewer (my default behavior), I know what the filename is going to be.
I still find it a bit odd that the file now has three titles, as it were: the file name, the one in the pdf metadata (optional but usually there), and now this one in Zotero, which I didn’t even know about. I used to think it was just the file name. This might be the part of the model that many people won’t grok instantly.
Since this title is purely generic, is there perhaps a way to just not show it at all? Indicate the file type of the main file with just an icon somewhere.
Files saved from the web have always been given titles like "ScienceDirect Full Text PDF" or "Submitted Version" (while being automatically renamed based on the parent item metadata), so anyone who has used the Zotero Connector has seen similarly generic titles. They (or a plugin they used) might have done something to overwrite those with the filename, but our goal has always been to avoid unnecessarily cluttering the items list with redundant data. Z7 just goes further towards that goal. Zotero has never done anything with the PDF metadata, which is often absent or junk.
I was one of those people who had files automatically renamed with Zotfile (I think), so I never left those generic titles alone. I don’t know what other people do, of course, so maybe that’s unusual behavior. Again, I thought that was just the file name.
> Zotero has never done anything with the PDF metadata, which is often absent or junk.
I realize pdf metadata is often pretty useless, or worse.
> I mean, you don't have to expand the parent item — as I say, you can just double-click on the parent item to open the default attachment — but if you do, there's has to be a title in the items list. There's just no reason to duplicate the parent metadata.
My suggestion was not to include the default attachment in a list like additional ones. Not quite sure what that would look like, but it potentially lessens clutter, especially when most of the time, there’s just one attachment, at least in my setup. A duplicated file name doesn’t seem much different or worse from a generic “PDF”, though I understand the point about searching.
So I think I get the idea. As I said, I’ll live with it for a while. It’s clear that we’ve got different expectations about what info should be where.
https://s3.amazonaws.com/zotero.org/images/forums/u84240/ja8hi6jz68s2a9glaayr.png
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();
}
if (title.endsWith('.epub')) {
attachment.setField('title', 'EPUB');
await attachment.saveTx();
}
}
Where can I find the JavaScript API documentation please?
You can write code to do whatever you want (and the JS API isn't relevant for that — this is basic JS string manipulation), but all we're doing here is providing an option to set titles that have already been changed to match the filename back to default simple titles. We'll be adding a menu option for that shortly so that running code manually isn't required. New titles going forward would be unchanged.
It is impossible to manipulate strings without knowing the objects and object interfaces specific to Zotero.
Your script would not rename epubs, so I added a couple of lines. I mistyped EPUB and want to correct it not but not sure how.