summaryrefslogtreecommitdiffstats
path: root/fb.py
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2019-02-06 16:57:03 +0100
committerFlorian Pritz <bluewind@xinu.at>2019-02-06 16:57:03 +0100
commit56aea98c351afd9f26f56ddb8791e9319fb26be2 (patch)
tree10687a93ebf5730b09e5e74a4abd1b23a36ba4b7 /fb.py
parentdf16f2b307c5940b03336aa27f051e2bd4601f5c (diff)
Support changing filename when repastingdev
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'fb.py')
-rwxr-xr-xfb.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/fb.py b/fb.py
index d38f580..d6de696 100755
--- a/fb.py
+++ b/fb.py
@@ -611,7 +611,10 @@ class FBClient:
upload_files.append(file)
if len(upload_files) == 1 and not upload_files[0].should_upload():
- upload_files[0] = self.url_to_file(self.config['pastebin']+'/'+upload_files[0].id)
+ filename = None
+ if self.args.name != FBClient.DEFAULT_NAME:
+ filename = self.args.name
+ upload_files[0] = self.url_to_file(self.config['pastebin']+'/'+upload_files[0].id, filename)
resp = self.curlw.upload_files(upload_files)
@@ -689,8 +692,10 @@ class FBClient:
return File(arg)
- def url_to_file(self, url):
- outfile = os.path.join(self.tempdir, os.path.basename(url.strip("/")))
+ def url_to_file(self, url, filename=None):
+ if filename is None:
+ filename = os.path.basename(url.strip("/"))
+ outfile = os.path.join(self.tempdir, filename)
self.curlw.dl_file(url, outfile)
return File(outfile)