From 0fea6222661922d4eccae77c8bd802495f817d92 Mon Sep 17 00:00:00 2001 From: Dimitar Todorov Date: Sun, 14 Nov 2021 13:44:41 +0200 Subject: [PATCH] push: fix http storage ignoring method setting Add method overriding the default put_file in http.py where the upload method is passed to the http implementation. Fixes: #6694 --- dvc/fs/http.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/dvc/fs/http.py b/dvc/fs/http.py index 9bbeca9da..a27f00e8d 100644 --- a/dvc/fs/http.py +++ b/dvc/fs/http.py @@ -1,11 +1,13 @@ import threading +from typing import Any from funcy import cached_property, memoize, wrap_with from dvc import prompt +from dvc.progress import DEFAULT_CALLBACK from dvc.scheme import Schemes -from .fsspec_wrapper import FSSpecWrapper, NoDirectoriesMixin +from .fsspec_wrapper import AnyFSPath, FSSpecWrapper, NoDirectoriesMixin @wrap_with(threading.Lock()) @@ -127,3 +129,14 @@ class HTTPFileSystem(NoDirectoriesMixin, FSSpecWrapper): def unstrip_protocol(self, path: str) -> str: return path + + def put_file( + self, + from_file: AnyFSPath, + to_info: AnyFSPath, + callback: Any = DEFAULT_CALLBACK, + **kwargs, + ) -> None: + kwargs["method"] = self.upload_method + self.fs.put_file(from_file, to_info, callback=callback, **kwargs) + self.fs.invalidate_cache(self.path.parent(to_info))