Zotero not finding my PDF attachments

Hello,

I am currently using Zotero 5.0.96 on Linux Ubuntu 20.04. I am also using Zotfile to move my attachments to a mounted folder that is connected to my Google Drive storage. When I use the Zotero Connector for Firefox and import an article along with its PDF file from a website, it is added just fine to Zotero. However, when I click on the article in Zotero, I get a message that it can't find my PDF file. It looks like it is looking in the Zotero storage folder in the Zotero data folder for the file, instead of acting like a linked file. It appears that when I use the Zotero connector in Firefox, it is storing the PDF as a Stored file and not Linked file. My Zotfile configuration has the Location of Files setting set to Custom and the folder is pointing to my mounted folder connected to my Google Drive storage. When the PDF attachment is imported through the browser connector, the file is moved to the folder setup for Zotfile Location of Files custom folder location. So, that is working. The file location that Zotero shows when it can't find the file does not exist. So, at least that is correct that it can't find the file. Also, I have the Zotero Linked attachment Base Directory also pointing to this mounted folder. In addition, I have configured Zotfile to allow Zotero to rename the files, instead of using its own logic. What appears to be happening is that Zotero is not storing these PDF attachments as Linked files, but seems to be storing them as Stored files, which is not what I want in order to get this to work. When I right-click on the article and go to Manage attachments and then Rename attachment. it also cannot find the file.

So, using the Zotero connector for FireFox on Linux along with Zotfile, how do I get Zotero to store the files as Linked files, so it can find my PDF's?
  • I also want to state that if after I import the article and PDF into Zotero through the FireFox Zotero connector, where the PDF appears to be added as a Stored, and not Linked file, if I then add the file that was moved to my mounted Google Drive folder as a Linked file, then I can access that PDF as a Linked file just fine. Then I can delete the PDF that was imported as a Stored file and keep the PDF that was imported as a Linked file.

    So, again, my questions is, how can I eliminate the extra steps of adding the file as a Linked file and then deleting the Stored file version when I use the FireFox Zotero connector to add the article and PDF to Zotero?
  • That sounds like it would be a bug in ZotFile, which handles the whole moving and linking operation.

    What happens if you drag a file to a Zotero item (so that it's stored in Zotero) and then use right-click --> Manage Attachments --> Rename attached items. Same thing, or does that actually turn the attachment into a link?

    Also, how did you install Zotero?
  • When I drag a file from the Files app over to Zotero, it first adds it to Zotero as a top-level item and is a Stored file. Zotfile does not even move the file over to folder specified in its settings for Location of Files. I have to drag the file so that it is part of another top-level item. At this point, if I double-click on the PDF attachment, I can view it in my PDF viewer (Okular). When I select "Rename attached items", Zotfile does copy the file over to the Location of files folder, but names the file to the other Linked file I had already for that top-level item. I can confirm, though, that it is the file that I just dragged over into Zotero. However, when I attempt to open the file to view it from Zotero, Zotero says it can't find the file and was looking for the file in the Zotero/storage folder, so again Zotfile does not seem to be converting the file to a Linked file.

    I would agree that this is may be a bug with Zotfile. I did go to the Zotfile Github repository and looked at the issues, and it appears that someone else has had this issue with Ubuntu Linux. However, it looks like the project is dormant, as no new releases have been made for over a year, and the developer has indicated that he does not plan to work on it anytime in the near future.

    As for how I installed Zotero, I downloaded the Linux installation file from the Zotero website and followed the instructions on this page: https://www.zotero.org/support/installation.

    Any ideas on how to get this to work? Or am I stuck with having to create a linked file for the attachment and delete the original Stored file?
  • One other idea. Could it be a permissions issue running on Linux with the way that Zotero is assigning its permissions to files that would prevent other processes (in this case the Zotfile add-on) from changing the file from a Stored file to Linked file in Zotero?
  • I'm afraid other than fixing this in ZotFile or finding someone willing to do so, there's currently no obvious solution. It's a little odd that there aren't more reports of this, so it's possible that something else on your system, yes.
    However, I'd expect permissions to affect the ability of Zotfile to move the file (which seems to work fine), not changing it to a link (which happens purely in the database).

    One thing worth trying is if this is related to using a mounted folder (volume?). I haven't looked at the ZotFile code for this, but I'd assume it's expecting some sort of confirmation from the system that the file has been moved before triggering the conversion to a link. It's possible that it's not getting that back from the file system -- at least for testing, try this with a custom location set to the same volume as Zotero, see if that works. If it does, you'll still need to figure out what to do about it, but at least you have narrowed down the issue and have a possible workaround.
  • I'm using a cloud drive client called rclone and mounting my Google Drive Zotero folder to a local folder was an easy way to get this setup to work. What I really wanted to do is actually store the files locally and have rclone sync with Google Drive, much like how Google Drive or OneDrive client works on Windows or Mac where it stores the files on your local drive and then syncs with the server side whenever changes are made to that local folder. I will need to look further into how to accomplish that with rclone, and then I will give that a try to see if it fixes the issue with Zotero. I will also try using a custom folder outside of Zotero without connecting to Google Drive with rclone and see if that solves the issue as well.

    I will let you know what I find out.
  • This is what I was able to determine.

    If I have Zotfile move files to a local, unmounted, folder, then Zotfile works just fine, converting the PDF attachment to a Linked file. I can then use rclone periodically to sync the files in my local folder with Google Drive. I'm not sure if rclone has a way to do this automatically, but maybe I can create a background script that periodically syncs using rclone.

    So, using rclone to mount my Google Drive Zotero folder to a local folder is causing Zotfile to not perform its conversion from Stored File to Linked File completely. I was hoping that if I mount the Google Drive Zotero folder to a local folder I would be able to autosync the files with Google Drive, but that does not seem to be working when using rclone. Now that I've figured out the issue, I am going to look further into using rclone to automatically sync, instead of needing to run a command from the Terminal.

    Thank you for all your help in identifying the underlying issue here.
  • I had exactly the same issue here. It seems rclone is working too slow. I had configured a cache for rclone and Zotfile worked like a charm. Then my rc cache configuration suddenly stop working and I had to change it for a simple mount. That is when Zotfile stop working. I guess there is a sort of waiting time that is exceed during the confirmation that the file was moved, making Zotfile to fail.
  • Thank you so much to you all. After 3 hours of troubleshooting I was getting very desperate. Out of curiosity, @alexispaz @rkanagy have you guys found any decent workaround? Looking at rclone vfs options is making my head hurt. I've also considered just using rsync between a local folder and the rclone mounted one, but that is another possible point of failure/added complexity.

    Cheers
  • Leaving this here for future reference.

    After some testing, this rclone option works for me,

    --vfs-cache-mode full

    with all the defaults in the rclone systemd unit (https://github.com/rclone/rclone/wiki/Systemd-rclone-mount#systemd) left untouched. I'm using onedrive (business, uni provided) and Ubuntu 20.04.4

    Probably an overkill, but can't spend much time testing at the moment.


  • I ran into a similar problem. For me, going to Edit -> Preferences (Advanced tab) -> Config Editor and setting extensions.zotero.baseAttachmentPath and extensions.zotfile.dest_dir to the google drive dir where I had my PDFs stored did the trick (hopefully without causing other probems, tbc).
  • no need to do this in the config editor: both of those preferences are exposed in the GUI, the base attachment path in Zotero under files and folders and the Zotfile one in the ZotFile preferences as custom directory.
  • Yep. IIRC I did that, but for whatever reason it did not appear in the Config Editor. So I guess it is best to follow adamsmith's advice and only if that does not work, double check the Config Editor.
Sign In or Register to comment.