Removing broken attachments

This discussion was created from comments split from: PDF icon on link attachments (possible bug?).
  • I believe I observe similar as described here in that discussion, some of my pdfs show linked-file attachments (maybe interpreted as linked-URL attachments, because when I click on them my browser is trying to open them).

    I believe these links could be remaints of my former Mendeleydesktop installations (I ex-/imported the whole databases in March 2019). They are dead links and I cannot find any way to get rid of them.

    Does anybody know how to get rid of theses?
  • some of my pdfs show linked-file attachments (maybe interpreted as linked-URL attachments, because when I click on them my browser is trying to open them)
    Those two attachments types aren't interchangeable. If a linked-file attachment is missing, it will say the file is missing when you try to open it, not open the browser. A linked-file attachment will be either a white page or a PDF icon with a chain on it. A linked-URL attachment will have a blue webpage icon with a chain and will show a URL in the right-hand pane.

    In any case, I'm not totally sure what your question is. You can delete an attachment the same way you can delete any other item — by selecting it in the middle pane and pressing Delete on your keyboard.

    If you're asking how to delete them in bulk, if you can construct a search that matches only those attachments, either in the search bar or with a saved search, you can use Select All to select just the matching items and delete them that way.
  • Thanks for yor prompt reply, I will try to explain better:

    (1) I have pdf attachments with an icon in red for the pdf reader software; on the right-hand side the file name, number of pages, date of the last change to the file, status of indexing, related entries and Tags are shown.

    (2) I also have also pdf attachments with a bluish icon (with a camera?); on the right-hand side above the file name a dead link in blue is given (I suspect from my former mendeley installation), number of pages are not indicated, date of the last change to the file is given, status of indexing is fixed to "no", related entries and Tags are shown. The file cannot be indexed.

    So my question is, is there some way to fix?
    Or need I manually delete this file and try to readd it and see if it is fixed? Problem I believe I have quite a big bunch of such files.
  • edited December 30, 2020
    But are you saying none of these files are available? The file and the link are totally separate things, and it's not clear which one you're concerned with. If a file for a snapshot isn't available locally, it will open the associated link, but that's not really relevant.

    If there's no chain icon on the attachment icon, these are stored files, and they should exist on the computer where you originally added them to Zotero. Whether they came from Mendeley shouldn't be relevant — Zotero shouldn't have imported missing files. If you added them on another computer, you likely just haven't synced those files and should see Files Not Syncing.
  • Okay, I give up, but thanks anyway for trying to help me.

    I just deleted one of these pdf files of the category (2) I described above and then reattached the identical file. Now everything looks normal as described in category (1). The number of pages is given, the file can be indexed and certainly there is none of these dead links, which I suspected coming from mendeley import. You could see it as a visual flaw, but I didn't like it. So I will treat these attachments manually in the future.

    Thanks again!!
  • I believe the whole thing was a snapshot, at least the icon looks identical to the one of a snapshot which is appended to a reference when you introduce it with zotero connector.

    Clicking on this snapshot icon also opened a pdf residing on my computer in the Zotero/storage directory. Do not know how this happened but I have several of such entries...
  • If you right-click one of these attachments with a snapshot symbol and select "Show File", does it show a PDF file in Zotero's "storage" directory? If so, it seems like there was an issue with your Mendeley data import.

    You could inspect the attachment item properties with Zotero's JavaScript API. Select an attachment and run: var items = Zotero.getActiveZoteroPane().getSelectedItems(); items;.

    Stored files show "linkMode": "imported_file", snapshots show "linkMode": "imported_url".

    Perhaps there is a way to correct the attachments through a script, but I don't know if there's a good way to do this properly. One could search for snapshots with "filename": "*.pdf". Besides the "linkMode", some other fields might need to be corrected as well.
  • Currently, Zotero seems to import Mendeley data as 'imported_url' attachments for some PDF files with a single URL, see here. I'm not sure that this is how it's supposed to be. The idea might have been that website items could have attached snapshots that are PDF files.

    @grimmomueller: Could you specify your dead links further? When importing through Zotero's browser connector, PDF attachments are saved with links to their original URL. Other types of links should probably be saved as separate attachments when importing from Mendeley. I don't know whether one can assume anything about links that Mendeley exports together with a PDF file.
  • Currently, Zotero seems to import Mendeley data as 'imported_url' attachments for some PDF files with a single URL, see here. I'm not sure that this is how it's supposed to be.
    'imported_url' is correct for PDFs saved from the web. That's what Zotero uses when you save PDFs from your browser, and it's what it uses for Mendeley imports when there's a URL containing 'pdf' associated with the same item.

    It sounds like one issue here is just that some/all of those PDFs weren't assigned the PDF content type, which is why they're showing the camera icon instead of the PDF icon. I can look into that. A future version of Zotero will also fix those automatically when they're opened.

    I'm not clear if there are other problems, but there's no point trying to debug those if @grimmomueller doesn't want to.
  • Thanks for all those replies; as far as I can judge all three posts after my last post probably are well related to my problem and there is no other problem!

    I will not try to get a hold of any script for fixing this issue. When I stumble over such an affected reference with attached pdf, I will probably fix it by re-attaching the pdf which already worked once as described above.

    @qqbb : The dead links can be any links in my opinion, sometimes they are ones to websites, sometimes they seem to be old paths (linux and windows) of one of my past computers...

    I believe the only affected items are roughly 180 entries which contained pdfs with annotations from within mendeley. I remember I had to treat them according to special import advice (but it forgot details; I also had to revert my encrypted mendeley database for versions >18)

    @dstillman : If this could be automatically fixed in some future versions, sounds great. But for now I can handle it with my workaround of re-attaching.
    Thanks again and a better new year.
Sign In or Register to comment.