Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions gma/src/android/native_ad_image_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <jni.h>

#include <memory>
#include <regex>
#include <string>

#include "gma/src/android/gma_android.h"
Expand Down Expand Up @@ -71,6 +72,10 @@ NativeAdImage::NativeAdImage(
FIREBASE_ASSERT(j_uri);
internal_->uri = util::JniUriToString(env, j_uri);

// Images requested with an android user agent may return webp images. Trim
// webp parameter from image url to get the original JPG/PNG image.
internal_->uri = std::regex_replace(internal_->uri, std::regex("-rw"), "");

// NativeAdImage scale.
jdouble j_scale =
env->CallDoubleMethod(internal_->native_ad_image,
Expand Down