diff --git a/openbr/plugins/gallery/binary.cpp b/openbr/plugins/gallery/binary.cpp index b83184c..2e710c0 100644 --- a/openbr/plugins/gallery/binary.cpp +++ b/openbr/plugins/gallery/binary.cpp @@ -16,6 +16,7 @@ #include #include +#include #ifdef _WIN32 #include @@ -271,8 +272,9 @@ class utGallery : public BinaryGallery t.file.set("Label", ut.label); t.append(cv::Mat(1, dataSize, CV_8UC1, dataStart).clone() /* We don't want a shallow copy! */); } else { - if (!gallery.atEnd()) - qFatal("Failed to read universal template header!"); + gallery.close(); + /*if (!gallery.atEnd()) + qFatal("Failed to read universal template header!");*/ } return t; } @@ -284,7 +286,7 @@ class utGallery : public BinaryGallery qFatal("Expected 16-byte ImageID, got: %d bytes.", imageID.size()); const int32_t algorithmID = (t.isEmpty() || t.file.fte) ? 0 : t.file.get("AlgorithmID"); - const QByteArray url = t.file.get("URL", t.file.name).toLatin1(); + const QByteArray url = QUrl::fromUserInput(t.file.get("URL", t.file.name)).toEncoded(); int32_t x = 0, y = 0; uint32_t width = 0, height = 0; diff --git a/openbr/plugins/io/download.cpp b/openbr/plugins/io/download.cpp index 712a813..eb6f476 100644 --- a/openbr/plugins/io/download.cpp +++ b/openbr/plugins/io/download.cpp @@ -57,7 +57,9 @@ private: if (!url.contains("://")) url = "file://" + url; dst.file.set("URL", url); - if (url.startsWith("file://")) + if (url.startsWith("file:///")) + url = url.mid(8); + else if (url.startsWith("file://")) url = url.mid(7); QIODevice *device = NULL;