diff --git a/api/funkwhale_api/music/models.py b/api/funkwhale_api/music/models.py index 4325a1697054682a6a975052e5923a52d99dd822..197a8fc1c9644a43a4910edfc35e57f7fa8f4d81 100644 --- a/api/funkwhale_api/music/models.py +++ b/api/funkwhale_api/music/models.py @@ -688,6 +688,8 @@ TRACK_FILE_IMPORT_STATUS_CHOICES = ( ("skipped", "Skipped"), ) +def sanitize_remote_location_path(filename): + return filename.replace("/", "-") def get_file_path(instance, filename): if isinstance(instance, UploadVersion): @@ -696,6 +698,7 @@ def get_file_path(instance, filename): if instance.library.actor.get_user(): return common_utils.ChunkedPath("tracks")(instance, filename) else: + filename = sanitize_remote_location_path(filename) # we cache remote tracks in a different directory return common_utils.ChunkedPath("federation_cache/tracks")(instance, filename) diff --git a/changes/changelog.d/1435.bug b/changes/changelog.d/1435.bug new file mode 100644 index 0000000000000000000000000000000000000000..7329f8b4a28055c57e9259a30d85d6832b94f5b2 --- /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