server/storage: check whether path exists before trying to create directory
Deploy Book / Deploy (push) Has been skipped
Build / tests (2.24, ubuntu-latest) (push) Failing after 43s
Build / tests (2.28, ubuntu-latest) (push) Failing after 43s
Build / build (ubuntu-latest) (push) Failing after 50s
Build / nix-matrix (push) Failing after 49s
Lint / Lint (push) Failing after 48s
Build / build (macos-latest) (push) Has been cancelled
Build / tests (2.26, ubuntu-latest) (push) Failing after 50s
Build / tests (default, ubuntu-latest) (push) Failing after 49s
Build / tests (2.24, macos-latest) (push) Has been cancelled
Build / tests (2.26, macos-latest) (push) Has been cancelled
Build / tests (2.28, macos-latest) (push) Has been cancelled
Build / tests (default, macos-latest) (push) Has been cancelled
Build / ${{ matrix.name }} (push) Has been cancelled
Build / image (push) Has been cancelled
Deploy Book / Deploy (push) Has been skipped
Build / tests (2.24, ubuntu-latest) (push) Failing after 43s
Build / tests (2.28, ubuntu-latest) (push) Failing after 43s
Build / build (ubuntu-latest) (push) Failing after 50s
Build / nix-matrix (push) Failing after 49s
Lint / Lint (push) Failing after 48s
Build / build (macos-latest) (push) Has been cancelled
Build / tests (2.26, ubuntu-latest) (push) Failing after 50s
Build / tests (default, ubuntu-latest) (push) Failing after 49s
Build / tests (2.24, macos-latest) (push) Has been cancelled
Build / tests (2.26, macos-latest) (push) Has been cancelled
Build / tests (2.28, macos-latest) (push) Has been cancelled
Build / tests (default, macos-latest) (push) Has been cancelled
Build / ${{ matrix.name }} (push) Has been cancelled
Build / image (push) Has been cancelled
This commit is contained in:
@@ -101,13 +101,20 @@ async fn upgrade_0_to_1(storage_path: &Path) -> ServerResult<()> {
|
||||
|
||||
impl LocalBackend {
|
||||
pub async fn new(config: LocalStorageConfig) -> ServerResult<Self> {
|
||||
fs::create_dir_all(&config.path).await.map_err(|e| {
|
||||
if !fs::try_exists(&config.path).await.map_err(|e| {
|
||||
ErrorKind::StorageError(anyhow::anyhow!(
|
||||
"Failed to create storage directory {}: {}",
|
||||
config.path.display(),
|
||||
e
|
||||
"Failed to check whether storage directory {} exists: {e}",
|
||||
config.path.display()
|
||||
))
|
||||
})?;
|
||||
})? {
|
||||
fs::create_dir_all(&config.path).await.map_err(|e| {
|
||||
ErrorKind::StorageError(anyhow::anyhow!(
|
||||
"Failed to create storage directory {}: {}",
|
||||
config.path.display(),
|
||||
e
|
||||
))
|
||||
})?;
|
||||
};
|
||||
|
||||
let version = read_version(&config.path).await?;
|
||||
if version == 0 {
|
||||
|
||||
Reference in New Issue
Block a user