decode URLS when loading from file system

This commit is contained in:
Konstantin Käfer
2015-04-30 13:27:25 +02:00
parent 4cf3d4ef9f
commit 248e48eacc

View File

@@ -3,6 +3,7 @@
#include <mbgl/storage/response.hpp>
#include <mbgl/util/std.hpp>
#include <mbgl/util/util.hpp>
#include <mbgl/util/url.hpp>
#include <mbgl/util/uv.hpp>
#include <uv.h>
@@ -58,10 +59,10 @@ AssetRequest::AssetRequest(const Resource& resource_, Callback callback_, uv_loo
std::string path;
if (url.size() <= 8 || url[8] == '/') {
// This is an empty or absolute path.
path = url.substr(8);
path = mbgl::util::percentDecode(url.substr(8));
} else {
// This is a relative path. Prefix with the application root.
path = assetRoot + "/" + url.substr(8);
path = assetRoot + "/" + mbgl::util::percentDecode(url.substr(8));
}
uv_fs_open(loop, &req, path.c_str(), O_RDONLY, S_IRUSR, fileOpened);