diff --git a/td/telegram/BackgroundType.cpp b/td/telegram/BackgroundType.cpp index 9f1145dfd..27943b2f3 100644 --- a/td/telegram/BackgroundType.cpp +++ b/td/telegram/BackgroundType.cpp @@ -143,7 +143,7 @@ Result BackgroundFill::get_background_fill(Slice name) { } auto get_color = [](Slice color_string) -> Result { - auto r_color = hex_to_integer_safe(color_string); + auto r_color = hex_to_integer_safe(url_decode(color_string, true)); if (r_color.is_error() || color_string.size() > 6) { return Status::Error(400, "WALLPAPER_INVALID"); } @@ -179,7 +179,7 @@ Result BackgroundFill::get_background_fill(Slice name) { Slice prefix("rotation="); if (begins_with(parameters, prefix)) { - rotation_angle = to_integer(parameters.substr(prefix.size())); + rotation_angle = to_integer(url_decode(parameters.substr(prefix.size()), true)); if (!is_valid_rotation_angle(rotation_angle)) { rotation_angle = 0; } @@ -276,7 +276,7 @@ void BackgroundType::apply_parameters_from_link(Slice name) { } } -string BackgroundType::get_link() const { +string BackgroundType::get_link(bool is_first) const { string mode; if (is_blurred_) { mode = "blur"; @@ -304,7 +304,7 @@ string BackgroundType::get_link() const { return link; } case Type::Fill: - return fill_.get_link(true); + return fill_.get_link(is_first); default: UNREACHABLE(); return string(); diff --git a/td/telegram/BackgroundType.h b/td/telegram/BackgroundType.h index ba517c3e8..730e444db 100644 --- a/td/telegram/BackgroundType.h +++ b/td/telegram/BackgroundType.h @@ -107,7 +107,7 @@ class BackgroundType { void apply_parameters_from_link(Slice name); - string get_link() const; + string get_link(bool is_first = true) const; bool has_equal_type(const BackgroundType &other) const { return type_ == other.type_;