From c29e58d29debb86a55d2eb38e7033928df769003 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Wed, 6 Feb 2019 16:38:29 +0100 Subject: Extract url_to_file method Signed-off-by: Florian Pritz --- fb.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fb.py b/fb.py index 03a7b92..67a55ad 100755 --- a/fb.py +++ b/fb.py @@ -681,12 +681,14 @@ class FBClient: if arg.startswith(self.config['pastebin']): return File(id=self.extractId(arg)) if re.match('https?://', arg): - outfile = os.path.join(self.tempdir, os.path.basename(arg.strip("/"))) - self.curlw.dl_file(arg, outfile) - return File(outfile) + return self.url_to_file(arg) return File(arg) + def url_to_file(self, url): + outfile = os.path.join(self.tempdir, os.path.basename(url.strip("/"))) + self.curlw.dl_file(url, outfile) + return File(outfile) def extractId(self, arg): arg = arg.replace(self.config['pastebin'], '') -- cgit v1.2.3-24-g4f1b