Skip to content
Snippets Groups Projects
Commit 21b0e5ee authored by Andreas Traczyk's avatar Andreas Traczyk
Browse files

filetransfer: adjust the url decoding for qml component file urls

Gitlab: #92
Change-Id: I10ae359b26c70cacdb1e1168658678f3f5b2a96e
parent 2cb49217
No related branches found
No related tags found
No related merge requests found
......@@ -149,10 +149,7 @@ Item {
mode: JamiFileDialog.Mode.OpenFile
onAccepted: {
// No need to trim file:///.
AvAdapter.shareFile(jamiFileDialog.file)
}
onAccepted: AvAdapter.shareFile(jamiFileDialog.file)
}
Component.onCompleted: {
......
......@@ -264,9 +264,9 @@ MessagesAdapter::sendImage(const QString& message)
QString msg(message);
#ifdef Q_OS_WIN
msg = msg.replace("file:///", "");
msg = msg.replace("file://", "");
#else
msg = msg.replace("file:///", "/");
msg = msg.replace("file://", "/");
#endif
QFileInfo fi(msg);
QString fileName = fi.fileName();
......@@ -337,7 +337,7 @@ MessagesAdapter::deleteInteraction(const QString& arg)
void
MessagesAdapter::openFile(const QString& arg)
{
QUrl fileUrl("file:///" + arg);
QUrl fileUrl("file://" + arg);
if (!QDesktopServices::openUrl(fileUrl)) {
qDebug() << "Couldn't open file: " << fileUrl;
}
......@@ -399,9 +399,9 @@ MessagesAdapter::pasteKeyDetected()
*/
for (int i = 0; i < urlList.size(); ++i) {
/*
* Trim file:/// from url.
* Trim file:// from url.
*/
QString filePath = urlList.at(i).toString().remove(0, 8);
QString filePath = urlList.at(i).toString().remove("file://");
QByteArray imageFormat = QImageReader::imageFormat(filePath);
/*
......
......@@ -353,6 +353,9 @@ UtilsAdapter::toFileAbsolutepath(QString inputFileName)
QString
UtilsAdapter::getAbsPath(QString path)
{
// Note: this function is used on urls returned from qml-FileDialogs which
// contain 'file:///' for reasons we don't understand.
// TODO: this logic can be refactored into the JamiFileDialog component.
#ifdef Q_OS_WIN
return path.replace("file:///", "").replace("\n", "").replace("\r", "");
#else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment