diff --git a/libraries/model-serializers/src/FSTReader.cpp b/libraries/model-serializers/src/FSTReader.cpp index 80f90797456..0b832f78fdb 100644 --- a/libraries/model-serializers/src/FSTReader.cpp +++ b/libraries/model-serializers/src/FSTReader.cpp @@ -20,6 +20,9 @@ #include #include + +const QStringList SINGLE_VALUE_PROPERTIES{"name", "filename", "texdir", "script", "comment"}; + hifi::VariantMultiHash FSTReader::parseMapping(QIODevice* device) { hifi::VariantMultiHash properties; @@ -32,9 +35,25 @@ hifi::VariantMultiHash FSTReader::parseMapping(QIODevice* device) { if (sections.size() < 2) { continue; } + + // We can have URLs like: + // filename = https://www.dropbox.com/scl/fi/xxx/avatar.fbx?rlkey=xxx&dl=1\n + // These confuse the parser due to the presence of = in the URL. + // + // SINGLE_VALUE_PROPERTIES contains a list of things that may be URLs or contain an = + // for some other reason, and that we know for sure contain only a single value after + // the first =. + // + // Really though, we should just use JSON instead. QByteArray name = sections.at(0).trimmed(); - if (sections.size() == 2) { - properties.insert(name, sections.at(1).trimmed()); + bool isSingleValue = SINGLE_VALUE_PROPERTIES.contains(name); + + if (sections.size() == 2 || isSingleValue) { + // As per the above, we can have '=' signs inside of URLs, so instead of + // using the split string, just use everything after the first '='. + + QString value = line.mid(line.indexOf("=")+1).trimmed(); + properties.insert(name, value); } else if (sections.size() == 3) { QVariantHash heading = properties.value(name).toHash(); heading.insert(sections.at(1).trimmed(), sections.at(2).trimmed());