Skip to content

Commit 9b0d14f

Browse files
[rust] Fix conditions to check edge in cache (#13057)
* [rust] Remove extra conditions when browser binary exists * [rust] Postpone check admin permission in Edge just before download --------- Co-authored-by: Titus Fortner <[email protected]>
1 parent 566db85 commit 9b0d14f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

rust/src/lib.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,6 @@ pub trait SeleniumManager {
208208
&mut self,
209209
original_browser_version: String,
210210
) -> Result<Option<PathBuf>, Error> {
211-
if WINDOWS.is(self.get_os()) && self.is_edge() && !self.is_windows_admin() {
212-
return Err(anyhow!(format_one_arg(
213-
NOT_ADMIN_FOR_EDGE_INSTALLER_ERR_MSG,
214-
self.get_browser_name(),
215-
)));
216-
}
217-
218211
let browser_version;
219212
let cache_path = self.get_cache_path()?;
220213
let mut metadata = get_metadata(self.get_logger(), &cache_path);
@@ -284,14 +277,21 @@ pub trait SeleniumManager {
284277

285278
// Checking if browser version is in the cache
286279
let browser_binary_path = self.get_browser_binary_path(&original_browser_version)?;
287-
if browser_binary_path.exists() && !self.is_edge() {
280+
if browser_binary_path.exists() {
288281
self.get_logger().debug(format!(
289282
"{} {} already exists",
290283
self.get_browser_name(),
291284
browser_version
292285
));
293286
} else {
294287
// If browser is not available, download it
288+
if WINDOWS.is(self.get_os()) && self.is_edge() && !self.is_windows_admin() {
289+
return Err(anyhow!(format_one_arg(
290+
NOT_ADMIN_FOR_EDGE_INSTALLER_ERR_MSG,
291+
self.get_browser_name(),
292+
)));
293+
}
294+
295295
let browser_url = self.get_browser_url_for_download(&original_browser_version)?;
296296
self.get_logger().debug(format!(
297297
"Downloading {} {} from {}",

0 commit comments

Comments
 (0)