Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vigoo committed Oct 18, 2024
1 parent b4df945 commit 9dd0067
Showing 1 changed file with 24 additions and 16 deletions.
40 changes: 24 additions & 16 deletions golem-worker-executor-base/src/storage/blob/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,30 +235,38 @@ impl BlobStorage for InMemoryBlobStorage {
.map(|namespace_data| namespace_data.contains_key(path.to_string_lossy().as_ref()))
.unwrap_or_default()
{
return Ok(ExistsResult::Directory);
Ok(ExistsResult::Directory)
} else {
let dir = path
.parent()
.map(|p| p.to_string_lossy().to_string())
.unwrap_or_default();
let key = path
.file_name()
.expect("Path must have a file name")
.to_string_lossy()
.to_string();
if path == Path::new("") {
if self.data.get(&namespace).is_some() {
Ok(ExistsResult::Directory)
} else {
Ok(ExistsResult::DoesNotExist)
}
} else {
let dir = path
.parent()
.map(|p| p.to_string_lossy().to_string())
.unwrap_or_default();
let key = path
.file_name()
.expect("Path must have a file name")
.to_string_lossy()
.to_string();

if let Some(namespace_data) = self.data.get(&namespace) {
if let Some(directory) = namespace_data.get(&dir) {
if directory.contains_key(&key) {
Ok(ExistsResult::File)
if let Some(namespace_data) = self.data.get(&namespace) {
if let Some(directory) = namespace_data.get(&dir) {
if directory.contains_key(&key) {
Ok(ExistsResult::File)
} else {
Ok(ExistsResult::DoesNotExist)
}
} else {
Ok(ExistsResult::DoesNotExist)
}
} else {
Ok(ExistsResult::DoesNotExist)
}
} else {
Ok(ExistsResult::DoesNotExist)
}
}
}
Expand Down

0 comments on commit 9dd0067

Please sign in to comment.