diff --git a/src/gui/Pages/Chat/Timeline/EventMediaLoader.qml b/src/gui/Pages/Chat/Timeline/EventMediaLoader.qml index b702c09d..2a4cb4d5 100644 --- a/src/gui/Pages/Chat/Timeline/EventMediaLoader.qml +++ b/src/gui/Pages/Chat/Timeline/EventMediaLoader.qml @@ -28,6 +28,9 @@ HLoader { property string downloadedPath: "" + readonly property string title: + singleMediaInfo.media_title || utils.urlFileName(mediaUrl) + readonly property var imageExtensions: [ "bmp", "gif", "jpg", "jpeg", "png", "pbm", "pgm", "ppm", "xbm", "xpm", "tiff", "webp", "svg", diff --git a/src/gui/Utils.qml b/src/gui/Utils.qml index 06c37e38..ad47f28e 100644 --- a/src/gui/Utils.qml +++ b/src/gui/Utils.qml @@ -298,9 +298,13 @@ QtObject { } + function urlFileName(url) { + return url.toString().split("/").slice(-1)[0].split("?")[0] + } + + function urlExtension(url) { - return url.toString().split("/").slice(-1)[0].split("?")[0].split(".") - .slice(-1)[0].toLowerCase() + return urlFileName(url).split(".").slice(-1)[0] }