Fix decoding of resources (fixes issue #2966)

Use LoadDataResourceString instead of GetDataResource. It will perform
decoding if necessary.
This commit is contained in:
Marshall Greenblatt
2020-07-02 14:45:16 -04:00
parent 48fc0bd220
commit 88b88251e7
3 changed files with 17 additions and 16 deletions

View File

@ -158,14 +158,15 @@ class InternalHandlerFactory : public CefSchemeHandlerFactory {
action.mime_type = GetMimeType(url.path());
if (!action.bytes && action.resource_id >= 0) {
action.bytes =
CefAppManager::Get()->GetContentClient()->GetDataResourceBytes(
std::string str =
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
action.resource_id);
if (!action.bytes) {
if (str.empty()) {
NOTREACHED() << "Failed to load internal resource for id: "
<< action.resource_id << " URL: " << url.spec().c_str();
return nullptr;
}
action.bytes = base::RefCountedString::TakeString(&str);
}
if (action.bytes) {