Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
efb26916 by wurstsalat at 2022-09-18T13:56:12+02:00
imprv: Preview: Improve mime type detection
Fixes #11150
- - - - -
1 changed file:
- gajim/common/preview.py
Changes:
=====================================
gajim/common/preview.py
=====================================
@@ -237,8 +237,13 @@ def _accept_uri(urlparts: ParseResult,
if urlparts.scheme in ('https', 'http'):
if app.settings.get('preview_allow_all_images'):
mime_type = guess_mime_type(uri)
- if (mime_type not in MIME_TYPES or
- mime_type == 'application/octet-stream'):
+ if mime_type not in MIME_TYPES:
+ return False
+
+ if mime_type == 'application/octet-stream' and uri != oob_url:
+ # guess_mime_type yields 'application/octet-stream' for
+ # paths without suffix. Check oob_url to make sure we
+ # display a preview for files sent via http upload.
return False
return True
@@ -345,7 +350,7 @@ def _on_orig_load_finished(self,
log.error('%s: %s', preview.orig_path.name, error)
return
- preview.mime_type = guess_mime_type(preview.orig_path)
+ preview.mime_type = guess_mime_type(preview.orig_path, data)
preview.file_size = os.path.getsize(preview.orig_path)
if preview.is_previewable:
if preview.create_thumbnail(data):
@@ -368,7 +373,7 @@ def _on_thumb_load_finished(data: Optional[bytes],
return
preview.thumbnail = data
- preview.mime_type = guess_mime_type(preview.orig_path)
+ preview.mime_type = guess_mime_type(preview.orig_path, data)
preview.file_size = os.path.getsize(preview.orig_path)
try:
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/efb269164b7c563777f1e684771cd40f…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/efb269164b7c563777f1e684771cd40f…
You're receiving this email because of your account on dev.gajim.org.
Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
78319461 by wurstsalat at 2022-09-18T11:41:42+02:00
cfix: ChatBanner: Escape contact name for title and tooltip
Fixes #11154
- - - - -
1 changed file:
- gajim/gtk/chat_banner.py
Changes:
=====================================
gajim/gtk/chat_banner.py
=====================================
@@ -17,6 +17,7 @@
from typing import Any
from typing import Optional
+from gi.repository import GLib
from gi.repository import Gtk
import cairo
@@ -246,7 +247,7 @@ def _update_content(self) -> None:
assert self._contact is not None
assert self._client is not None
- name = self._contact.name
+ name = GLib.markup_escape_text(self._contact.name)
if self._contact.jid.bare_match(self._client.get_own_jid()):
name = _('Note to myself')
@@ -254,7 +255,7 @@ def _update_content(self) -> None:
if self._contact.is_pm_contact:
gc_contact = self._client.get_module('Contacts').get_contact(
self._contact.jid.bare)
- name = f'{name} ({gc_contact.name})'
+ name = f'{name} ({GLib.markup_escape_text(gc_contact.name)})'
label_text = f'<span>{name}</span>'
label_tooltip = name
@@ -273,7 +274,7 @@ def _update_content(self) -> None:
label_tooltip = f'{name} {chatstate}'
self._ui.name_label.set_markup(label_text)
- self._ui.name_label.set_tooltip_text(label_tooltip)
+ self._ui.name_label.set_tooltip_markup(label_tooltip)
if isinstance(self._contact, GroupchatContact):
self_contact = self._contact.get_self()
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/78319461b2be41b32ec62d6343f7184a…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/78319461b2be41b32ec62d6343f7184a…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
ad5a9075 by Philipp Hörist at 2022-09-15T19:42:09+02:00
cfix: Plugins: Stay backwards compatible with published plugins
- - - - -
1 changed file:
- gajim/plugins/pluginmanager.py
Changes:
=====================================
gajim/plugins/pluginmanager.py
=====================================
@@ -83,7 +83,7 @@ def is_usable(self) -> bool:
return False
platform = sys.platform
- if platform not in ('win32', 'darwin'):
+ if platform not in ('win32', 'darwin', 'linux'):
# sys.platform can return an unknown amount of unix/linux derivates
platform = 'others'
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/ad5a9075678d9f63d461dadc597ed8e1…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/ad5a9075678d9f63d461dadc597ed8e1…
You're receiving this email because of your account on dev.gajim.org.
Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
9025c402 by wurstsalat at 2022-09-15T09:42:11+02:00
cfix: Read state sync: Don't fail if last message is not available
- - - - -
1 changed file:
- gajim/gtk/main.py
Changes:
=====================================
gajim/gtk/main.py
=====================================
@@ -982,6 +982,9 @@ def _on_read_state_sync(self, event: events.ReadStateSync) -> None:
last_message = app.storage.archive.get_last_conversation_line(
event.account, jid)
+ if last_message is None:
+ return
+
if event.marker_id != last_message.message_id:
return
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/9025c402ac382018cfa61c7b8d88d8c5…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/9025c402ac382018cfa61c7b8d88d8c5…
You're receiving this email because of your account on dev.gajim.org.