Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Commit 6af6bcc

Browse files
committed
Removed unwrap and fixed pipeline
1 parent 8312fc6 commit 6af6bcc

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.drone.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ steps:
77
- name: Run Tests
88
image: rust:latest
99
commands:
10+
- rustup component add clippy
1011
- cargo test
1112
- cargo clippy
1213
trigger:

server/src/backend/storage_backend.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,11 @@ impl StorageBackend<FileFighterUser> for FileFighter {
235235

236236
fn get_parent_and_name(path: &Path) -> Result<(PathBuf, &str)> {
237237
match (path.parent(), path.file_name()) {
238-
(Some(parent), Some(name)) => Ok((parent.to_path_buf(), name.to_str().unwrap())),
238+
(Some(parent), Some(name)) => Ok((
239+
parent.to_path_buf(),
240+
name.to_str()
241+
.ok_or_else(|| Error::new(ErrorKind::LocalError, "Filename was not valid utf-8"))?,
242+
)),
239243
(_, _) => Err(Error::new(
240244
ErrorKind::FileNameNotAllowedError,
241245
"Path for creating a directory must contain a parent and child component",

0 commit comments

Comments
 (0)