diff --git a/api/funkwhale_api/common/utils.py b/api/funkwhale_api/common/utils.py index 5d7d401d7..afb773725 100644 --- a/api/funkwhale_api/common/utils.py +++ b/api/funkwhale_api/common/utils.py @@ -75,11 +75,15 @@ def set_query_parameter(url, **kwargs): @deconstructible class ChunkedPath(object): + def sanitize_filename(self, filename): + return filename.replace("/", "-") + def __init__(self, root, preserve_file_name=True): self.root = root self.preserve_file_name = preserve_file_name def __call__(self, instance, filename): + self.sanitize_filename(filename) uid = str(uuid.uuid4()) chunk_size = 2 chunks = [uid[i : i + chunk_size] for i in range(0, len(uid), chunk_size)] diff --git a/changes/changelog.d/1435.bug b/changes/changelog.d/1435.bug new file mode 100644 index 000000000..7329f8b4a --- /dev/null +++ b/changes/changelog.d/1435.bug @@ -0,0 +1 @@ +Sanitize remote tracks' saving locations with slashes on their names (#1435) \ No newline at end of file