mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
set.download_file_name()增加suffix参数
This commit is contained in:
parent
897a9cd9c8
commit
572f0d51c4
@ -139,7 +139,7 @@ class BrowserDownloadManager(object):
|
|||||||
settings = TabDownloadSettings(tab_id if tab_id in TabDownloadSettings.TABS else self._page.tab_id)
|
settings = TabDownloadSettings(tab_id if tab_id in TabDownloadSettings.TABS else self._page.tab_id)
|
||||||
if settings.rename:
|
if settings.rename:
|
||||||
if settings.suffix is not None:
|
if settings.suffix is not None:
|
||||||
name = f'{settings.rename}.{settings.suffix}'
|
name = f'{settings.rename}.{settings.suffix}' if settings.suffix else settings.rename
|
||||||
|
|
||||||
else:
|
else:
|
||||||
tmp = kwargs['suggestedFilename'].rsplit('.', 1)
|
tmp = kwargs['suggestedFilename'].rsplit('.', 1)
|
||||||
@ -152,7 +152,9 @@ class BrowserDownloadManager(object):
|
|||||||
settings.suffix = None
|
settings.suffix = None
|
||||||
|
|
||||||
elif settings.suffix is not None:
|
elif settings.suffix is not None:
|
||||||
name = f'{kwargs["suggestedFilename"].rsplit(".", 1)[0]}.{settings.suffix}'
|
name = kwargs["suggestedFilename"].rsplit(".", 1)[0]
|
||||||
|
if settings.suffix:
|
||||||
|
name = f'{name}.{settings.suffix}'
|
||||||
settings.suffix = None
|
settings.suffix = None
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user