|
34 | 34 | #include <database/logs.h> |
35 | 35 | #include <database/cache.h> |
36 | 36 | #include <read/index.h> |
37 | | -#pragma GCC diagnostic push |
38 | | -#pragma GCC diagnostic ignored "-Weffc++" |
39 | | -#include <parsewebdata/ParseWebData.h> |
40 | | -#pragma GCC diagnostic pop |
41 | 37 |
|
42 | 38 |
|
43 | 39 | std::vector <std::string> workspace_get_default_names () |
@@ -582,18 +578,22 @@ std::map <int, int> workspace_add_bible_editor_number (std::map <int, std::strin |
582 | 578 | } |
583 | 579 |
|
584 | 580 |
|
| 581 | + |
| 582 | +// Input: List of URLs like this: /a/b?bible=1&topbar=0 |
585 | 583 | std::optional<std::string> get_first_bible_from_urls (const std::map <int,std::string>& urls) |
586 | 584 | { |
587 | 585 | for (const auto& [key, url] : urls) { |
588 | 586 | const std::vector <std::string> bits = filter::strings::explode (url, '?'); |
589 | 587 | if (bits.size() != 2) |
590 | 588 | continue; |
591 | 589 | if (!bits.at(1).empty ()) { |
592 | | - ParseWebData::WebDataMap web_data_map; |
593 | | - ParseWebData::parse_get_data (bits.at(1), web_data_map); |
594 | | - for (auto iter = web_data_map.cbegin(); iter != web_data_map.cend(); ++iter) { |
595 | | - if ((*iter).first == "bible") |
596 | | - return filter_url_urldecode ((*iter).second.value); |
| 590 | + // Explode the data on the ampersand ( & ) and then on the equal sign ( = ). |
| 591 | + std::vector<std::string> keys_values = filter::strings::explode(bits.at(1), '&'); |
| 592 | + for (const auto& fragment : keys_values) { |
| 593 | + std::vector<std::string> key_value = filter::strings::explode(fragment, '='); |
| 594 | + if (key_value.size() == 2) |
| 595 | + if (key_value.at(0) == "bible") |
| 596 | + return filter_url_urldecode (key_value.at(1)); |
597 | 597 | } |
598 | 598 | } |
599 | 599 | } |
|
0 commit comments