pulibrary / figgy

Valkyrie-based digital repository backend.
Other
35 stars 4 forks source link

PDFs should work in read-only mode #2866

Open escowles opened 5 years ago

escowles commented 5 years ago

Currently, PDFs are generated, attached to the resource, and then users are forwarded to the download URL for the new file. In read-only mode, this won't work, because we can't attach the generated PDF.

We should be able to generate a PDF and just send it to the user instead of attaching/redirecting.

Implementation

PDFs should not store on file_metadata, instead it should store in a known cache location.

To do this:

  1. Make a new cache StorageAdapter
  2. Have a way to generate a known Valkyrie::ID for a PDF in that adapter.
  3. Store PDFs in it if it doesn't exist already.
  4. Add a new path to the download controller to download from that cache.

We're going to prioritize this ticket around the next time we need to go into read only mode.

hackartisan commented 1 year ago

We recently made PDFs serve in the case of an optimistic lock error. We could just generalize that to rescue everything, or we could figure out what the error would be in read-only and add that specifically.

https://github.com/pulibrary/figgy/commit/500bda231dd02bbf1ba2fb7823a3731d4c58e18c

kelea99 commented 1 year ago

@hackartisan @tpendragon @eliotjordan @Seanwarren77 @sdellis - can we get this on a workcycle board in the next 3-6 weeks?

Reasoning: while not a sudden priority that is blocking the most recent need for Figgy Upgrade now, it would be incredibly helpful to our colleagues in SC/Mudd to have this implemented before the next read only moment for figgy.

hackartisan commented 5 months ago

This probably isn't working as implemented. The file that gets returned from the generator doesn't have the pdf attached to it, so it's likely showing a 404 now instead of a 500.

One idea is to store the generated pdfs at a known location with a predictable title (maybe the resource id sent to the generation job), and then have the download controller look in that location if it's not found on the resource.

As part of working this ticket, update or replace the skipped tests in spec/requests/scanned_resource_spec.