Skip to content

Conversation

paulfitz
Copy link
Member

Add support for GRIST_MAX_INTERNAL_ATTACHMENTS_BYTES which, if set, will cause Grist to refuse to add new attachments if the the total attachment size would exceed this amount, and the current document is not set to use external attachments.

Technically Grist docs can have attachments in several stores. This limit ignores that nuance.

Add support for `GRIST_MAX_INTERNAL_ATTACHMENTS_BYTES` which, if set,
will cause Grist to refuse to add new attachments if the current
document is not set to use external attachments and the total attachment
size would exceed this amount.

Technically Grist docs can have attachments in several stores. This
limit ignores that nuance.
Copy link
Contributor

@Spoffy Spoffy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all looks good - I've flagged up the transfer issue and requested changes to make sure it's seen, but if you're happy to leave that as-is then I'll approve :)

Comment on lines +3204 to +3208
// If not using external attachments, apply installation limit on size.
// Technically the attachmentStoreId being set doesn't mean all attachments
// are actually stored externally, and a determined person could
// work around this limit at the API level. That's fine, their
// reward will be pain.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed! I can imagine an in-UI workaround for this too (set to external, upload, transfer to internal).

I think either:

  • This is completely fine, and pain shall become their companion
  • We apply the limit during transfers too

I'll leave that up to you!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a thing where if starting a transfer to internal, limits are checked. Since it is easy to imagine a doc with a lot of attachments stored externally, then user clicking to make internal to e.g. make the doc standalone. Let me know if it looks ok. Didn't get into nuance of trying to free up space if there are lingering attachments on the road to deletion. It is a little silly since all transfers will fail if total attachment size is greater than limit, and communication with user is poor about errors. But it could be easily improved if this is a corner users do in practice find themselves in.

@paulfitz paulfitz requested a review from Spoffy July 25, 2025 17:33
@paulfitz paulfitz merged commit 45e2671 into main Jul 25, 2025
25 of 26 checks passed
@paulfitz paulfitz deleted the paulfitz/max-internal-attachments branch July 25, 2025 18:18
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.

2 participants