From cd42c1720247dd9c363ac99a5fa97ef4cf2e4acb Mon Sep 17 00:00:00 2001 From: Josh Schneier Date: Mon, 8 Jul 2024 00:16:52 -0400 Subject: [PATCH] [dropbox] Remove dead prefix removal code (#1425) --- storages/backends/dropbox.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/storages/backends/dropbox.py b/storages/backends/dropbox.py index 5feb9484..1d291cdd 100644 --- a/storages/backends/dropbox.py +++ b/storages/backends/dropbox.py @@ -32,12 +32,6 @@ class DropboxStorageException(Exception): DropBoxStorageException = DropboxStorageException -def removeprefix(prefix, name): - if name.startswith(prefix): - name = name[len(prefix) :] - return name - - class DropboxFile(File): def __init__(self, name, storage): self.name = name @@ -176,10 +170,7 @@ def _save(self, name, content): else: self._chunked_upload(content, self._full_path(name)) content.close() - # .save() validates the filename isn't absolute but Dropbox requires an - # absolute filename. Work with the absolute name internally but strip it - # off before passing up-the-chain. - return removeprefix(self.root_path, name).lstrip("/") + return name def _chunked_upload(self, content, dest_path): upload_session = self.client.files_upload_session_start(