Adds a check if the data folder is a directory and also returns a more verbose error message if the permission was denied when creating a file.
I tried adding something like the following to check_data_folder() as well
letmetadata=path.metadata().unwrap();ifmetadata.permissions().readonly(){warn!("Data folder '{}' is read-only.",data_folder);}
However, this does not really work because readonly() only checks if anyone has write permissions. 😖
🔄 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/2811
**Author:** [@stefan0xC](https://github.com/stefan0xC)
**Created:** 10/11/2022
**Status:** ✅ Merged
**Merged:** 10/14/2022
**Merged by:** [@dani-garcia](https://github.com/dani-garcia)
**Base:** `main` ← **Head:** `check-data-folder-permissions`
---
### 📝 Commits (2)
- [`7532072`](https://github.com/dani-garcia/vaultwarden/commit/7532072d50bd030bb7fd3b900af571049ef5378b) add check if data folder is a directory
- [`2dd5086`](https://github.com/dani-garcia/vaultwarden/commit/2dd508691689d4f5a9c39f411837300666f4dfc7) more verbose permission denied error
### 📊 Changes
**2 files changed** (+15 additions, -2 deletions)
<details>
<summary>View changed files</summary>
📝 `src/main.rs` (+4 -0)
📝 `src/util.rs` (+11 -2)
</details>
### 📄 Description
Adds a check if the data folder is a directory and also returns a more verbose error message if the permission was denied when creating a file.
I tried adding something like the following to `check_data_folder()` as well
```rust
let metadata = path.metadata().unwrap();
if metadata.permissions().readonly() {
warn!("Data folder '{}' is read-only.", data_folder);
}
```
However, this does not really work because [`readonly()`](https://github.com/rust-lang/rust/blob/5237c4d83db0a04a0119918b174ee642acd82d9c/library/std/src/sys/unix/fs.rs#L510-L513) only checks if _anyone_ has write permissions. :confounded:
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/dani-garcia/vaultwarden/pull/2811
Author: @stefan0xC
Created: 10/11/2022
Status: ✅ Merged
Merged: 10/14/2022
Merged by: @dani-garcia
Base:
main← Head:check-data-folder-permissions📝 Commits (2)
7532072add check if data folder is a directory2dd5086more verbose permission denied error📊 Changes
2 files changed (+15 additions, -2 deletions)
View changed files
📝
src/main.rs(+4 -0)📝
src/util.rs(+11 -2)📄 Description
Adds a check if the data folder is a directory and also returns a more verbose error message if the permission was denied when creating a file.
I tried adding something like the following to
check_data_folder()as wellHowever, this does not really work because
readonly()only checks if anyone has write permissions. 😖🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.