This commit is contained in:
Kovid Goyal 2020-02-22 08:58:49 +05:30
parent 20b2b0d5d4
commit 7af7fcf561
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -399,14 +399,15 @@ class WebView(RestartingWebEngineView, OpenWithHandler):
url = data.mediaUrl() url = data.mediaUrl()
if url.scheme() == FAKE_PROTOCOL: if url.scheme() == FAKE_PROTOCOL:
href = url.path().lstrip('/') href = url.path().lstrip('/')
c = current_container() if href:
resource_name = c.href_to_name(href) c = current_container()
if resource_name and c.exists(resource_name) and resource_name not in c.names_that_must_not_be_changed: resource_name = c.href_to_name(href)
self.add_open_with_actions(menu, resource_name) if resource_name and c.exists(resource_name) and resource_name not in c.names_that_must_not_be_changed:
if data.mediaType() == data.MediaTypeImage: self.add_open_with_actions(menu, resource_name)
mime = c.mime_map[resource_name] if data.mediaType() == data.MediaTypeImage:
if mime.startswith('image/'): mime = c.mime_map[resource_name]
menu.addAction(_('Edit %s') % resource_name, partial(self.edit_image, resource_name)) if mime.startswith('image/'):
menu.addAction(_('Edit %s') % resource_name, partial(self.edit_image, resource_name))
menu.exec_(ev.globalPos()) menu.exec_(ev.globalPos())
def open_with(self, file_name, fmt, entry): def open_with(self, file_name, fmt, entry):