Skip to content

Limit number of pages a document can have on upload. - #489

Merged
duckduckgrayduck merged 3 commits into
masterfrom
limit_num_pages
Sep 22, 2026
Merged

duckduckgrayduck merged 3 commits into
masterfrom
limit_num_pages

Conversation

@duckduckgrayduck

Copy link
Copy Markdown
Contributor

It raises a PageCountError which gets returned in the API. Here is me trying to upload a 2001 page document that lives on production on staging:
https://api.staging.documentcloud.org/api/documents/20014762/errors/

Closes part 1 of #479

@duckduckgrayduck duckduckgrayduck changed the title Limit number of pages a document on upload. Limit number of pages a document can have on upload. Sep 22, 2026
@eyeseast

Copy link
Copy Markdown
Contributor

This shows up in Sentry: https://muckrock.sentry.io/issues/7748986224/?alert_rule_id=927646&alert_timestamp=1790099553878&alert_type=email&environment=production&notification_uuid=6287b185-c3e7-4aa7-8509-785c6fd03e41&project=1844864&referrer=alert_email

I think that's fine, actually. We'll get some insight into how often people are hitting this limit and can decide what to do with that.

@eyeseast

eyeseast commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

I was able to upload a document on staging. The upload succeeds but processing fails, and we end up in this weird state: https://www.staging.documentcloud.org/documents/20014763-south-carolina-hearing-office-alj-dispositions-01-01-10-to-02-21-18/

This was something already on staging, so here's the original file: https://documentcloud-staging-files.s3.amazonaws.com/documents/20010618/south-carolina-hearing-office-alj-dispositions-01-01-10-to-02-21-18.pdf

We may need a check on the frontend to catch this earlier, or a better way to indicate that processing failed. These are probably follow-on issues.

Here's how it looks in the API:

@duckduckgrayduck

duckduckgrayduck commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Yea, it raises PageCountError() intentionally, similar to PdfSizeError().
Looking at that code, the PdfSizeError doesn't set a message which is observable in errors like this one is, it returns blank "" so errors swallows it. Since I am here, I am going to add a message for this too, and then the front-end can use that info to display a helpful failure message

@duckduckgrayduck
duckduckgrayduck merged commit 5682b6b into master Sep 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants