[PR #624] Fix issue with downloading attachments and PostgreSQL backend. #3685

Closed
opened 2025-10-09 18:28:06 +03:00 by OVERLORD · 0 comments
Owner

Original Pull Request: https://github.com/dani-garcia/vaultwarden/pull/624

State: closed
Merged: Yes


Apologies for the rapd-fire PR's. While testing today I realized that downloading attachments with the PostgreSQL backend is currently not working.

The root cause is that since attachments don't use UUID identifiers like the majority of other tables the usage of the CHAR(36) type causes the identifiers to get padded out to 36 characters with spaces because of the odd way PostgreSQL handles the CHAR type. Since the request URL's get trimmed this causes attachments to be not retrievable.

Since CHAR() in PostgreSQL is significantly different in behavior from MySQL and sqlite I added a migration that converts the CHAR() types to VARCHAR(). This appears to fix the attachments issue and should prevent any future padding issues caused by PostgreSQL's handling of the CHAR() type.

Please let me know if you'd like any changes.

**Original Pull Request:** https://github.com/dani-garcia/vaultwarden/pull/624 **State:** closed **Merged:** Yes --- Apologies for the rapd-fire PR's. While testing today I realized that downloading attachments with the PostgreSQL backend is currently not working. The root cause is that since attachments don't use UUID identifiers like the majority of other tables the usage of the `CHAR(36)` type causes the identifiers to get padded out to 36 characters with spaces because of the [odd way PostgreSQL handles the CHAR type](https://www.postgresql.org/docs/current/datatype-character.html). Since the request URL's get trimmed this causes attachments to be not retrievable. Since CHAR() in PostgreSQL is significantly different in behavior from MySQL and sqlite I added a migration that converts the `CHAR()` types to `VARCHAR()`. This appears to fix the attachments issue and should prevent any future padding issues caused by PostgreSQL's handling of the `CHAR()` type. Please let me know if you'd like any changes.
OVERLORD added the pull-request label 2025-10-09 18:28:06 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/vaultwarden#3685