freelawproject / recap

This repository is for filing issues on any RECAP-related effort.
https://free.law/recap/
12 stars 4 forks source link

Appellate: Failed PDF upload, "Duplicate key on unique_together constraint" #327

Closed mlissner closed 1 year ago

mlissner commented 1 year ago

I went purchased a docket with the dev version of RECAP today (on the main branch), and then clicked one of the items. It led to the attachment page, and I selected and purchased a document, which uploaded here:

https://www.courtlistener.com/api/rest/v3/recap/7398014/?court=cadc&upload_type=3

It reports the error that:

Duplicate key on unique_together constraint

Not sure why. This could indicate a back end issue or that it was uploaded incorrectly. Eduardo, can you check that the upload looks correct for a doc from this URL:

https://www.courtlistener.com/docket/66696476/shawn-musgrave-v-mark-warner/

It's the entry from 2022-10-28 that is described as, "STATEMENT OF ISSUES".

If the extension part looks good, then we should pass this to Alberto for a look next.

ERosendo commented 1 year ago

I reviewed this issue and found that the extension uploaded the file incorrectly.

The current implementation of the extension should send the document number and the attachment number when it uploads files from attachment menu pages. The extension uses a regex expression to parse these values from the title on the download confirmation page (here's the helper that handles the parse operation). This helper method expects a title that looks like the following (if the document belongs to an attachment page):

but in this case, the title on the download confirmation page is the following:

The extension is not sending the attachment number because it's not included in the title.

Here's a screenshot of the download confirmation page of a document from docket 22-5252 and also a screenshot of the download confirmation page of a document that belongs to an attachment page of a different docket.

Document from docket 22-5252

Document from docket 19-1083

mlissner commented 1 year ago

Nice analysis, thanks. I'll follow up with the courts, but until they fix themselves, I guess we gotta work with what we've got.

ERosendo commented 1 year ago

I also noticed that the attachment page shows the attachment number. Here's a screenshot of the attachment page for this docket entry

image

We can fix this issue if we pass the attachment number from the attachment page to the download confirmation page. We could use the tab storage to do this or add the attachment number as a query string parameter to the document link ( like ?attNumber=1).