if (utils::StartsWith(url, check)) {
url.erase(0, check.length());
} else {
- LOGGER(ERROR) << "Invalid appid";
+ LOGGER(ERROR) << "Invalid uri: {scheme:app} uri=" << origin;
return result;
}
} else if (utils::StartsWith(url, file_scheme)) {
}
if (url.empty()) {
- LOGGER(ERROR) << "URL Localization error";
+ LOGGER(ERROR) << "Invalid uri: uri=" << origin;
return result;
}
return result;
}
- LOGGER(ERROR) << "URL Localization error";
+ LOGGER(ERROR) << "Invalid uri: uri=" << origin << ", decoded=" << file_path;
return result;
}
#include "common/string_utils.h"
-#include <curl/curl.h>
#include <uuid/uuid.h>
#include <glib.h>
#include <math.h>
namespace common {
namespace utils {
-namespace {
-std::unique_ptr<CURL, decltype(curl_easy_cleanup)*>
- g_curl {nullptr, curl_easy_cleanup};
-} // namespace
-
std::string GenerateUUID() {
char tmp[37];
uuid_t uuid;
}
std::string UrlDecode(const std::string& url) {
- if (g_curl.get() == nullptr) {
- g_curl.reset(curl_easy_init());
- }
- std::unique_ptr<char, decltype(curl_free)*> decoded_str {
- curl_easy_unescape(g_curl.get(), url.c_str(), url.length(), NULL),
- curl_free };
-
+ std::unique_ptr<char, decltype(std::free)*> decoded_str {
+ g_uri_unescape_string(url.c_str(), NULL), std::free };
return decoded_str.get() != nullptr ? std::string(decoded_str.get()) : url;
}
std::string UrlEncode(const std::string& url) {
- if (g_curl.get() == nullptr) {
- g_curl.reset(curl_easy_init());
- }
- std::unique_ptr<char, decltype(curl_free)*> encoded_str {
- curl_easy_escape(g_curl.get(), url.c_str(), url.length()),
- curl_free };
-
+ std::unique_ptr<char, decltype(std::free)*> encoded_str {
+ g_uri_escape_string(url.c_str(), NULL, TRUE), std::free };
return encoded_str.get() != nullptr ? std::string(encoded_str.get()) : url;
}
BuildRequires: pkgconfig(elementary)
BuildRequires: pkgconfig(gio-2.0)
BuildRequires: pkgconfig(glib-2.0)
-BuildRequires: pkgconfig(libcurl)
BuildRequires: pkgconfig(libwebappenc)
BuildRequires: pkgconfig(manifest-handlers)
BuildRequires: pkgconfig(manifest-parser)