From 1d43d522e60818214a88c450ab10a58a33e4da59 Mon Sep 17 00:00:00 2001 From: miruka Date: Mon, 16 Dec 2019 18:22:25 -0400 Subject: [PATCH] Strip file:// prefix from copied downloaded paths --- TODO.md | 1 - src/qml/Chat/Timeline/EventFile.qml | 2 +- src/qml/Chat/Timeline/EventImage.qml | 3 ++- src/qml/Chat/Timeline/EventMediaLoader.qml | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/TODO.md b/TODO.md index 9e474ba5..2a22b2cf 100644 --- a/TODO.md +++ b/TODO.md @@ -1,6 +1,5 @@ # TODO -- strip file:// from copy path - some way to show name and date on EventFile - sentinel func to report path if already cached without having to click - verify eventfile height diff --git a/src/qml/Chat/Timeline/EventFile.qml b/src/qml/Chat/Timeline/EventFile.qml index 605741d6..54c69c03 100644 --- a/src/qml/Chat/Timeline/EventFile.qml +++ b/src/qml/Chat/Timeline/EventFile.qml @@ -30,7 +30,7 @@ HTile { eventDelegate.hoveredMediaTypeUrl = [ EventDelegate.Media.File, - loader.downloadedPath || loader.mediaUrl + loader.downloadedPath.replace(/^file:\/\//, "") || loader.mediaUrl ] } diff --git a/src/qml/Chat/Timeline/EventImage.qml b/src/qml/Chat/Timeline/EventImage.qml index 74034011..6e9204f4 100644 --- a/src/qml/Chat/Timeline/EventImage.qml +++ b/src/qml/Chat/Timeline/EventImage.qml @@ -90,7 +90,8 @@ HMxcImage { eventDelegate.hoveredMediaTypeUrl = [ EventDelegate.Media.Image, - loader.downloadedPath || loader.mediaUrl + loader.downloadedPath.replace(/^file:\/\//, "") || + loader.mediaUrl ] } } diff --git a/src/qml/Chat/Timeline/EventMediaLoader.qml b/src/qml/Chat/Timeline/EventMediaLoader.qml index 6e83cc31..b66df087 100644 --- a/src/qml/Chat/Timeline/EventMediaLoader.qml +++ b/src/qml/Chat/Timeline/EventMediaLoader.qml @@ -74,6 +74,7 @@ HLoader { if (! loader.mediaUrl.startsWith("mxc://")) { downloadedPath = loader.mediaUrl callback(loader.mediaUrl) + return } if (! downloadedPath) print("Downloading " + loader.mediaUrl + " ...")