BUG: Zotero won't import all attachments from Zotero RDF/XML

Hi,

I am currently migrating my academic reading biography from a long-demised reference manager. I do so by generating Zotero RDF/XML from my existing data (the code can be found at https://github.com/tillgrallert/convert_tss-to-bibliographic-data) and have encountered a reproducible import bug: Zotero fails to import any files with a # in their file names even if they are available on the file system.

Take for instance the following Zotero RDF/XML fragments:

<z:Attachment xmlns:xs="http://www.w3.org/2001/XMLSchema"
rdf:about="#uuid_2841851E-BD71-49E4-9599-8470F051A30B">
<z:itemType>attachment</z:itemType>
<rdf:resource rdf:resource="/local/path/image.jpg"/>
<dc:title/>
<z:linkMode>2</z:linkMode>
</z:Attachment>
<z:Attachment xmlns:xs="http://www.w3.org/2001/XMLSchema"
rdf:about="#uuid_7283E593-207F-41DB-A26E-5128C6FCE228">
<z:itemType>attachment</z:itemType>
<rdf:resource rdf:resource="/local/path/image #2.jpg"/>
<dc:title/>
<z:linkMode>2</z:linkMode>
</z:Attachment>


The first attachment will import just fine. The second won't. # is allowed as part of an URI in @rdf:about. Hence, I deem this behaviour to be a bug.

All the best,

Till
  • It has to be %23. The two URIs there aren't equivalent. In rdf:about it's a unique identifier, so using a fragment identifier for the current document is fine, but for rdf:resource, it's an actual file URI*, so if you keep the # then you're saying the file ends in image .

    It looks like we're not properly using %23 when exporting to RDF, though, so we'll fix that.

    * I'm not sure about using an absolute path there, if that's what you're doing. As far as I know we only export relative paths, which are valid URIs. For an absolute path, I would think it would technically need to be a file:// URI, but it's possible we're accepting regular absolute paths too.
  • Thanks for responding and for pointing out that the two URI's aren't equivalent. Your proposed solution of escaping # with %23, however, doesn't work. Zotero doesn't import the file regardless of whether one uses # or %23. Prefixing file:// doesn't influence this behaviour.

    I also ought to point out that this is not a Zotero export bug! The Zotero RDF/XML is of my own making to import references form another software.
  • Well, it wasn't really proposed — I tested it and it worked when I changed it from # to %23. If you're on Windows, the path handling might be different.

    And I'm aware that this is your generated RDF. I'm just pointing out that we were also generating similarly incorrect RDF. We're working on a fix.
  • Sorry for the wrong assumptions. The fix currently doesn't work on OSX 10.14. Will give it another try before renaming all the files and keep you updated.
Sign In or Register to comment.