diff options
author | Florian Pritz <bluewind@xinu.at> | 2019-02-06 16:57:03 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2019-02-06 16:57:03 +0100 |
commit | 56aea98c351afd9f26f56ddb8791e9319fb26be2 (patch) | |
tree | 10687a93ebf5730b09e5e74a4abd1b23a36ba4b7 | |
parent | df16f2b307c5940b03336aa27f051e2bd4601f5c (diff) |
Support changing filename when repastingdev
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rwxr-xr-x | fb.py | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -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) |