1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-12-28 14:38:52 +00:00

Fix logic bug

This commit is contained in:
Pierre HUBERT 2020-06-26 09:06:48 +02:00
parent dad2363c92
commit 4f2216d835

View File

@ -505,12 +505,12 @@ impl HttpRequestHandler {
/// Get an optional virtual directory included in the request /// Get an optional virtual directory included in the request
pub fn post_checked_virtual_directory_opt(&mut self, name: &str, target_id: u64, target_type: VirtualDirType) -> ResultBoxError<Option<String>> { pub fn post_checked_virtual_directory_opt(&mut self, name: &str, target_id: u64, target_type: VirtualDirType) -> ResultBoxError<Option<String>> {
if !self.has_post_parameter(name) { let dir = self.post_string_opt(name, 0, false)?;
if dir.is_empty() {
return Ok(None); return Ok(None);
} }
let dir = self.post_virtual_directory(name)?;
if !virtual_directory_helper::check_availability(&dir, target_id, target_type)? { if !virtual_directory_helper::check_availability(&dir, target_id, target_type)? {
self.forbidden("Requested virtual directory is not available!".to_string())?; self.forbidden("Requested virtual directory is not available!".to_string())?;
} }