fix(plugin): sanitize local repo path telemetry

This commit is contained in:
InfinityPacer
2026-04-19 05:28:40 +08:00
committed by jxxghp
parent 4a4d93e7f9
commit b7ee6ca8c4
2 changed files with 52 additions and 4 deletions

View File

@@ -0,0 +1,23 @@
from unittest import TestCase
class PluginHelperTest(TestCase):
def test_sanitize_repo_url_for_statistic_keeps_remote_url(self):
try:
from app.helper.plugin import PluginHelper
except ModuleNotFoundError as exc:
self.skipTest(f"missing dependency: {exc}")
repo_url = "https://github.com/InfinityPacer/MoviePilot-Plugins"
self.assertEqual(repo_url, PluginHelper.sanitize_repo_url_for_statistic(repo_url))
def test_sanitize_repo_url_for_statistic_strips_local_path(self):
try:
from app.helper.plugin import PluginHelper
except ModuleNotFoundError as exc:
self.skipTest(f"missing dependency: {exc}")
repo_url = "local://TestPlugin?path=/Users/InfinityPacer/GitHub/MoviePilot/MoviePilot-Plugins&version=v2"
self.assertEqual(
"local://TestPlugin?version=v2",
PluginHelper.sanitize_repo_url_for_statistic(repo_url)
)