From 08e1a601e4aa13cdfb3bea836b89524cc13b07bf Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 27 Jun 2023 14:58:49 +0200 Subject: Fix nyaa default avatar --- src/plugins/NyaaSi.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/NyaaSi.cpp b/src/plugins/NyaaSi.cpp index 38e3c21..ec2322f 100644 --- a/src/plugins/NyaaSi.cpp +++ b/src/plugins/NyaaSi.cpp @@ -535,7 +535,11 @@ namespace QuickMedia { auto *item_data = (BodyItemContext*)userdata; QuickMediaStringView src = quickmedia_html_node_get_attribute_value(node->node, "src"); if(src.data && item_data->index < item_data->body_items->size()) { - (*item_data->body_items)[item_data->index]->thumbnail_url.assign(src.data, src.size); + std::string thumbnail_url; + if(src.size > 0 && src.data[0] == '/') + thumbnail_url += "https://nyaa.si"; + thumbnail_url.append(src.data, src.size); + (*item_data->body_items)[item_data->index]->thumbnail_url = std::move(thumbnail_url); (*item_data->body_items)[item_data->index]->thumbnail_size = mgl::vec2i(120, 120); item_data->index++; } @@ -578,7 +582,7 @@ namespace QuickMedia { void NyaaSiSearchPage::set_sort_type(NyaaSiSortType sort_type) { this->sort_type = sort_type; title = category_name + " | " + sort_type_names[(size_t)sort_type]; - title.erase(title.end() - 5, title.end()); // Erase emoji character and space at the end. TODO: Remove this when tabs support emojis. + title.erase(title.end() - 6, title.end()); // Erase emoji character and space at the end. TODO: Remove this when tabs support emojis. } PluginResult NyaaSiSortOrderPage::submit(const SubmitArgs &args, std::vector&) { -- cgit v1.2.3