]> git.proxmox.com Git - proxmox-backup.git/commitdiff
move pbs-tools/src/percent_encoding.rs to pbs-api-types/src/percent_encoding.rs
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 25 Nov 2021 10:48:52 +0000 (11:48 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 25 Nov 2021 10:48:52 +0000 (11:48 +0100)
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
pbs-api-types/Cargo.toml
pbs-api-types/src/lib.rs
pbs-api-types/src/percent_encoding.rs [new file with mode: 0644]
pbs-client/src/http_client.rs
pbs-client/src/task_log.rs
pbs-tools/src/lib.rs
pbs-tools/src/percent_encoding.rs [deleted file]
proxmox-backup-client/src/task.rs
src/bin/proxmox-backup-manager.rs

index 3bee23ba9249e4995d18c3abbf79b4a23b6d8625..cd5dc12909bc027986c26aa5be08a629a7d8ef64 100644 (file)
@@ -12,6 +12,7 @@ lazy_static = "1.4"
 libc = "0.2"
 nix = "0.19.1"
 openssl = "0.10"
+percent-encoding = "2.1"
 regex = "1.2"
 serde = { version = "1.0", features = ["derive"] }
 
index bb5d152fb37783a6db815b1daf16171af14c0395..2ecd5170d1ec188b59167d7e4690c407a7b008cc 100644 (file)
@@ -4,6 +4,7 @@ use serde::{Deserialize, Serialize};
 use anyhow::bail;
 
 pub mod common_regex;
+pub mod percent_encoding;
 
 use proxmox_schema::{
     api, const_regex, ApiStringFormat, ApiType, ArraySchema, Schema, StringSchema, ReturnType,
diff --git a/pbs-api-types/src/percent_encoding.rs b/pbs-api-types/src/percent_encoding.rs
new file mode 100644 (file)
index 0000000..afe011e
--- /dev/null
@@ -0,0 +1,22 @@
+use percent_encoding::{utf8_percent_encode, AsciiSet};
+
+/// This used to be: `SIMPLE_ENCODE_SET` plus space, `"`, `#`, `<`, `>`, backtick, `?`, `{`, `}`
+pub const DEFAULT_ENCODE_SET: &AsciiSet = &percent_encoding::CONTROLS // 0..1f and 7e
+    // The SIMPLE_ENCODE_SET adds space and anything >= 0x7e (7e itself is already included above)
+    .add(0x20)
+    .add(0x7f)
+    // the DEFAULT_ENCODE_SET added:
+    .add(b' ')
+    .add(b'"')
+    .add(b'#')
+    .add(b'<')
+    .add(b'>')
+    .add(b'`')
+    .add(b'?')
+    .add(b'{')
+    .add(b'}');
+
+/// percent encode a url component
+pub fn percent_encode_component(comp: &str) -> String {
+    utf8_percent_encode(comp, percent_encoding::NON_ALPHANUMERIC).to_string()
+}
index 30099b38ddeb7b29af315cc5520d3b36f95fb7ea..046a7b1791a259ce212ce7fe03214df1e6743beb 100644 (file)
@@ -23,9 +23,9 @@ use proxmox_http::uri::build_authority;
 use proxmox_async::broadcast_future::BroadcastFuture;
 
 use pbs_api_types::{Authid, Userid, RateLimitConfig};
+use pbs_api_types::percent_encoding::DEFAULT_ENCODE_SET;
 use pbs_tools::json::json_object_to_query;
 use pbs_tools::ticket;
-use pbs_tools::percent_encoding::DEFAULT_ENCODE_SET;
 
 use super::pipe_to_stream::PipeToSendStream;
 use super::PROXMOX_BACKUP_TCP_KEEPALIVE_TIME;
index e8874619ae40eea63b3fd3baf1c98be59a96e905..e607829a9584bf19bb8bb3b8c6d6e28168cf3e0c 100644 (file)
@@ -7,7 +7,7 @@ use futures::*;
 
 use proxmox_router::cli::format_and_print_result;
 
-use pbs_tools::percent_encoding::percent_encode_component;
+use pbs_api_types::percent_encoding::percent_encode_component;
 
 use super::HttpClient;
 
index 11c8171c8b0697f123e9ea2f54c2782e92373d38..857efcb7e6fb8bff0d8c2eaae9f55066046c57eb 100644 (file)
@@ -5,7 +5,6 @@ pub mod io;
 pub mod json;
 pub mod lru_cache;
 pub mod nom;
-pub mod percent_encoding;
 pub mod sha;
 pub mod sync;
 pub mod ticket;
diff --git a/pbs-tools/src/percent_encoding.rs b/pbs-tools/src/percent_encoding.rs
deleted file mode 100644 (file)
index afe011e..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-use percent_encoding::{utf8_percent_encode, AsciiSet};
-
-/// This used to be: `SIMPLE_ENCODE_SET` plus space, `"`, `#`, `<`, `>`, backtick, `?`, `{`, `}`
-pub const DEFAULT_ENCODE_SET: &AsciiSet = &percent_encoding::CONTROLS // 0..1f and 7e
-    // The SIMPLE_ENCODE_SET adds space and anything >= 0x7e (7e itself is already included above)
-    .add(0x20)
-    .add(0x7f)
-    // the DEFAULT_ENCODE_SET added:
-    .add(b' ')
-    .add(b'"')
-    .add(b'#')
-    .add(b'<')
-    .add(b'>')
-    .add(b'`')
-    .add(b'?')
-    .add(b'{')
-    .add(b'}');
-
-/// percent encode a url component
-pub fn percent_encode_component(comp: &str) -> String {
-    utf8_percent_encode(comp, percent_encoding::NON_ALPHANUMERIC).to_string()
-}
index 5d83a988a771330c32724c9e56973efcbb885a85..f879d05758f50a6f7c8731c6a417f115f4f8129e 100644 (file)
@@ -5,7 +5,7 @@ use proxmox_schema::api;
 use proxmox_router::cli::*;
 
 use pbs_client::display_task_log;
-use pbs_tools::percent_encoding::percent_encode_component;
+use pbs_api_types::percent_encoding::percent_encode_component;
 use pbs_tools::json::required_string_param;
 
 use pbs_api_types::UPID;
index 4a055032953ab0e5929b1635fef3164ff2decc29..0867ce45a63e145a887a607d4711d1bfba717ff7 100644 (file)
@@ -10,8 +10,8 @@ use proxmox_schema::api;
 
 use pbs_client::{display_task_log, view_task_result};
 use pbs_config::sync;
-use pbs_tools::percent_encoding::percent_encode_component;
 use pbs_tools::json::required_string_param;
+use pbs_api_types::percent_encoding::percent_encode_component;
 use pbs_api_types::{
     GroupFilter, SyncJobConfig,
     DATASTORE_SCHEMA, GROUP_FILTER_LIST_SCHEMA, IGNORE_VERIFIED_BACKUPS_SCHEMA, REMOTE_ID_SCHEMA,