schon/evibes/ftpstorage.py

15 lines
412 B
Python

from typing import Any
from urllib.parse import urlparse
from storages.backends.ftp import FTPStorage
class AbsoluteFTPStorage(FTPStorage): # type: ignore
# noinspection PyProtectedMember
# noinspection PyUnresolvedReferences
def _get_config(self) -> Any:
cfg = super()._get_config()
url = urlparse(self.location)
cfg["path"] = url.path or cfg["path"]
return cfg