Procházet zdrojové kódy

refactor(core): remove `BaseDirectory::Current` variant

Lucas Nogueira před 3 roky
rodič
revize
696dca58a9

+ 6 - 0
.changes/remove-current-base-directory.md

@@ -0,0 +1,6 @@
+---
+"tauri": patch
+"api": patch
+---
+
+Remove the `BaseDirectory::Current` enum variant for security reasons.

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
core/tauri/scripts/bundle.js


+ 1 - 9
core/tauri/src/api/path.rs

@@ -4,10 +4,7 @@
 
 //! Types and functions related to file system path operations.
 
-use std::{
-  env,
-  path::{Component, Path, PathBuf},
-};
+use std::path::{Component, Path, PathBuf};
 
 use crate::{Config, Env, PackageInfo};
 
@@ -60,8 +57,6 @@ pub enum BaseDirectory {
   /// The default App config directory.
   /// Resolves to [`BaseDirectory::Config`].
   App,
-  /// The current working directory.
-  Current,
   /// The Log directory.
   /// Resolves to [`BaseDirectory::Home/Library/Logs/{bundle_identifier}`] on macOS
   /// and [`BaseDirectory::Config/{bundle_identifier}/logs`] on linux and windows.
@@ -90,7 +85,6 @@ impl BaseDirectory {
       Self::Video => "$VIDEO",
       Self::Resource => "$RESOURCE",
       Self::App => "$APP",
-      Self::Current => "$CWD",
       Self::Log => "$LOG",
     }
   }
@@ -116,7 +110,6 @@ impl BaseDirectory {
       "$VIDEO" => Self::Video,
       "$RESOURCE" => Self::Resource,
       "$APP" => Self::App,
-      "$CWD" => Self::Current,
       "$LOG" => Self::Log,
       _ => return None,
     };
@@ -206,7 +199,6 @@ pub fn resolve_path<P: AsRef<Path>>(
       BaseDirectory::Video => video_dir(),
       BaseDirectory::Resource => resource_dir(package_info, env),
       BaseDirectory::App => app_dir(config),
-      BaseDirectory::Current => Some(env::current_dir()?),
       BaseDirectory::Log => log_dir(config),
     };
     if let Some(mut base_dir_path_value) = base_dir_path {

+ 0 - 1
tooling/api/src/fs.ts

@@ -52,7 +52,6 @@ export enum BaseDirectory {
   Video,
   Resource,
   App,
-  Current,
   Log
 }
 

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů