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

Closed
opened 2026-03-03 08:52:58 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/dani-garcia/vaultwarden/pull/624
Author: @swedishborgie
Created: 9/16/2019
Status: Merged
Merged: 9/17/2019
Merged by: @dani-garcia

Base: masterHead: postgresql


📝 Commits (1)

  • 1264eb6 Added a migration that fixes #1 which caused attachments to be broken

📊 Changes

2 files changed (+53 additions, -0 deletions)

View changed files

migrations/postgresql/2019-09-16-150000_fix_attachments/down.sql (+26 -0)
migrations/postgresql/2019-09-16-150000_fix_attachments/up.sql (+27 -0)

📄 Description

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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/dani-garcia/vaultwarden/pull/624 **Author:** [@swedishborgie](https://github.com/swedishborgie) **Created:** 9/16/2019 **Status:** ✅ Merged **Merged:** 9/17/2019 **Merged by:** [@dani-garcia](https://github.com/dani-garcia) **Base:** `master` ← **Head:** `postgresql` --- ### 📝 Commits (1) - [`1264eb6`](https://github.com/dani-garcia/vaultwarden/commit/1264eb640a0ba95b8c1294918c6c65e7d5c734c9) Added a migration that fixes #1 which caused attachments to be broken ### 📊 Changes **2 files changed** (+53 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `migrations/postgresql/2019-09-16-150000_fix_attachments/down.sql` (+26 -0) ➕ `migrations/postgresql/2019-09-16-150000_fix_attachments/up.sql` (+27 -0) </details> ### 📄 Description 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 08:52:58 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vaultwarden#2763
No description provided.