File renamed when link to it is set
This has been logged and reported as bug D958285293.
My Zotero version 5.0.37.
Since 2 days it happens that during setting a link from a database entry to a file on my computer the file is renamed!
Initial situation:
On my computer there is the file "Der-Grundstein-1916-027.pdf".
Steps:
1. For the database entry
"Anonym: Ausdehnung der Frauenarbeit auf Bauten. Der Grundstein 29 (27) 1916. S. 149."
I open context menu Attach files | Attach link to file
2. I browse through my directories and select file "Der-Grundstein-1916-027.pdf".
Result:
In Zotero the link has the name "1916 - Ausdehnung der Frauenarbeit auf Bauten.pdf".
In the directory on my computer the file is renamed to "1916 - Ausdehnung der Frauenarbeit auf Bauten.pdf".
This has worked for years. I have a big problem with this. Please help.
My Zotero version 5.0.37.
Since 2 days it happens that during setting a link from a database entry to a file on my computer the file is renamed!
Initial situation:
On my computer there is the file "Der-Grundstein-1916-027.pdf".
Steps:
1. For the database entry
"Anonym: Ausdehnung der Frauenarbeit auf Bauten. Der Grundstein 29 (27) 1916. S. 149."
I open context menu Attach files | Attach link to file
2. I browse through my directories and select file "Der-Grundstein-1916-027.pdf".
Result:
In Zotero the link has the name "1916 - Ausdehnung der Frauenarbeit auf Bauten.pdf".
In the directory on my computer the file is renamed to "1916 - Ausdehnung der Frauenarbeit auf Bauten.pdf".
This has worked for years. I have a big problem with this. Please help.
@dstillman Should linked files be automatically renamed? I'm not sure I would expect that as a user (but can see the argument either way).
It did not occur to me that this is a setting and that a Zotero update would change something like that.
Changed it, and it works as desired.
renaming linked files seems inconsistent to me. Zotero doesn't delete linked files when you delete them; I don't think it should rename them, either. E.g. you may have other software pointed to the same file and this would break things.
People with linked files obviously might not want their files renamed, but I'm not sure how many of those people want any of their files renamed, so they might just want to turn off the pref.
It seems the OP's issue was mainly that they didn't know about the addition of auto-renaming at all, but that's separate from whether the behavior makes sense, and part of the reason we wrote a blog post for this release.
I can think of a variety of use cases for mixing stored and linked attachments, some of which automatic renaming makes sense and others where it doesn't. For example, if an attachment is linked because it is very large, has sensitive data, or is synced using Dropbox/similar, then automatic renaming makes sense. If a file is linked because it is being used by another program (e.g., I sometimes add links to analysis scripts or data files to Zotero items), then automatic renaming isn't desired (though in my case I still want all of my stored files to be renamed).
Two options I can think of:
1. Change the automatic renaming pref from a checkbox to a dropdown with the options: All files, Stored (not linked) files, No files.
2. Give the option to disable automatic renaming for specific files (e.g., a different keyboard shortcut for dragging, a checkbox in the file picker, a checkbox in the right pane when the attachment item is selected).
Either (or both) of these would increase the flexibility without adding too much complexity, I think.
I don't really mind the naming style as such, but it does mean that I've just broken every single hyperlink I have to those files in Word, Evernote etc. I use hyperlinks to my files quite extensively to save time linking between them so this is quite annoying.
I even went through all the preferences beforehand to make sure that I wasn't going to mess anything up - but the checkbox bwiernik mentions is to "automatically name attachment files", not linked files.
+1 for this kind of behaviour being unexpected and unacceptable, in my view - fine for attachments but not for links, as Zotero may not be the only program linked to each file!
The auto-renaming also applies only to PDFs by default, and it applies only to the first file you drag to an item, so it doesn't rename, say, a data file, or even a supplementary PDF that you attach to an item that already has a PDF.
(Also, to be clear, this was implemented a year ago, so it's not new, though you may have been using an outdated version until recently.)
But I agree that it's better to make this explicit, so in the latest Zotero beta I've added an additional "Rename linked files" preference, defaulting to off, below the original pref. People currently relying on the auto-renaming for linked files will need to enable it from the preferences.