Skip to content

Expose zip file metadata for attachments where it's relevant#178

Open
tnajdek wants to merge 1 commit into
zotero:masterfrom
tnajdek:expose-zip-enclosure-metadata
Open

Expose zip file metadata for attachments where it's relevant#178
tnajdek wants to merge 1 commit into
zotero:masterfrom
tnajdek:expose-zip-enclosure-metadata

Conversation

@tnajdek
Copy link
Copy Markdown
Member

@tnajdek tnajdek commented May 14, 2026

This PR will expose the zip metadata as links.zip to allow web-library to copy and rename snapshot attachments (zotero/web-library#657). It looks like this:

 "zip": {
                "type": "application/zip",
                "href": "<BASEURL>/groups/1/items/5IWPU6EA/file",
                "title": "3Z7Q4N6Q.zip",
                "length": 7825,
                "md5": "30beafba10cc25883d6e875dff6950d9"
            }

Without this change, the web library is unable to re-register a file copied to a group library. That's because the web library has no way to learn (nor calculate) the wrapper's MD5, filename, and byte size from the existing item JSON. The existing md5/filename describe the inner file, and links.enclosure only carries the proxy-view URL. We also need this to enable file renaming ability for snapshots in the web library (currently broken), albeit it will have to do a full zip-and-upload workflow.

The alternative would be to add more response headers to the CORS safe list in the ?info=1 response. However, that means that the web library has to run an extra request for every file it renames or copies. Since the data is already there, I've opted for an additional entry in links instead.

I've tested the changes locally. @dstillman If you believe this should be done differently, please let me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant