From cf7f349d0ffacc309952a51f9b8e5f2b3a7b6920 Mon Sep 17 00:00:00 2001
From: EorlBruder <eorl@bruder.space>
Date: Fri, 4 Jun 2021 00:50:34 +0200
Subject: [PATCH] Replace "/" in param-name with "_" during sanitizing

While sanitizing the params for filenames, this avoids creating
unwanted sub-dirs, when fields contain "/".

Fixes #17
---
 funkwhale_cli/utils.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/funkwhale_cli/utils.py b/funkwhale_cli/utils.py
index 9e075a7..9fda4d3 100644
--- a/funkwhale_cli/utils.py
+++ b/funkwhale_cli/utils.py
@@ -83,6 +83,8 @@ def sanitize_recursive(value):
     else:
         if value and str(value).startswith("/"):
             value = str(value)[1:]
+        if isinstance(value, str):
+            value = value.replace("/", "_")
         return pathvalidate.sanitize_filepath(str(value))
 
 
-- 
GitLab