Fix some types of downloads not triggering

This commit is contained in:
Fierelier 2023-03-16 13:34:48 +01:00
parent da1477ab9c
commit 186ccb89d9
1 changed files with 10 additions and 1 deletions

View File

@ -38,5 +38,14 @@ def decideDestination(download,suggested_filename):
def download(webContext,download):
download.connect("decide-destination",decideDestination)
WebKit2.WebContext.get_default().connect("download-started",download)
WebKit2.WebContext.get_default().connect("download-started",download)
def decidePolicy(webView,decision,decisionType):
if decisionType == WebKit2.PolicyDecisionType.RESPONSE:
if decision.is_mime_type_supported() == False:
decision.download()
return True
def onWebviewCreated(webView):
webView.connect("decide-policy",decidePolicy)
eventHandler["webview:created"] = onWebviewCreated