From 3015ce0f9d120df7583f838d1a47cb469fe5a727 Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Sun, 14 Jun 2026 23:01:47 +0300 Subject: fix: stabilize plugin config directories --- src/api/schema/plugins.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/api/schema/plugins.rs') diff --git a/src/api/schema/plugins.rs b/src/api/schema/plugins.rs index be9336c8..907f243b 100644 --- a/src/api/schema/plugins.rs +++ b/src/api/schema/plugins.rs @@ -107,7 +107,7 @@ pub enum PluginSourceKind { pub(crate) fn plugin_managed_path_component(value: &str) -> String { let slug = readable_plugin_path_slug(value); - let hash = short_plugin_id_hash(value); + let hash = short_plugin_id_hash_for_path_component(value); format!("{slug}-{hash}") } @@ -133,14 +133,14 @@ fn readable_plugin_path_slug(value: &str) -> String { } else { slug.chars().take(80).collect() }; - if has_windows_reserved_stem(&slug) { + if has_windows_reserved_stem_for_path_component(&slug) { slug.replace('.', "-") } else { slug } } -fn short_plugin_id_hash(value: &str) -> String { +pub(crate) fn short_plugin_id_hash_for_path_component(value: &str) -> String { use sha2::{Digest, Sha256}; let digest = Sha256::digest(value.as_bytes()); @@ -152,7 +152,7 @@ fn short_plugin_id_hash(value: &str) -> String { hash } -fn has_windows_reserved_stem(value: &str) -> bool { +pub(crate) fn has_windows_reserved_stem_for_path_component(value: &str) -> bool { let stem = value.split('.').next().unwrap_or(value); matches!( stem.to_ascii_uppercase().as_str(), -- cgit v1.2.3