- Issue created by @fengtan
- 🇦🇷Argentina tguerineauIn order to address the issue "Support URLs with multiple query parameters" on the social_media_links module, a thorough investigation has been carried out. Problem Description: 
 The issue with the social_media_links module was that it incorrectly handled URLs containing multiple query parameters, resulting in incorrectly formed links.Solution Implemented: 
 A custom Twig filter has been created to handle this. The filter decodes the URL, checks if there are query parameters, and if found, re-encodes them. This ensures that the URL query parameters maintain their structure while being correctly encoded. Here is the code for the custom Twig filter:public function safeLinkFilter($url) { // Decode the URL first. $url = urldecode($url); $url_parts = parse_url($url); // If we don't have query parameters, just return the original URL if (!isset($url_parts['query'])) { return $url; } parse_str($url_parts['query'], $query_array); // Re-encode the query parameters. $safe_query = http_build_query($query_array); // Rebuild the URL. $safe_url = $url_parts['scheme'] . '://' . $url_parts['host'] . $url_parts['path'] . '?' . $safe_query; if (isset($url_parts['fragment'])) { // Encode the fragment. $safe_url .= '#' . urlencode($url_parts['fragment']); } return $safe_url; }Alternative Solutions: 
 There has been a thorough search for alternative solutions, such as existing Drupal core or Twig filters that could achieve the same result. However, it appears that there is no built-in Drupal core solution or Twig filter that could solve this specific issue, hence the creation of the custom filter.I'm attaching the patch for review. I would appreciate any feedback or suggestions. 
- Status changed to Needs reviewabout 2 years ago 6:24pm 4 August 2023
- 🇦🇷Argentina tguerineauThis is an updated patch that includes an additional change: adding the `safe_link` filter to the second anchor tag in the social-media-links-platforms.html.twig template. The `safe_link` filter ensures that the URLs of the social media links are safe and properly formatted, even when they contain multiple query parameters. Our previous patch (social_media_links-support-multiple-query-parameters-3366866-3.patch) did not apply this filter to all URLs in the template, which could potentially leave some URLs improperly formatted. This patch rectifies that oversight. Please review this updated patch. 
- Status changed to RTBCalmost 2 years ago 10:38am 24 January 2024
- 🇮🇳India divya.sejekanVerified the issue - with patch #5 
 Issue is resolved , & is displayed in URL instead of &%3BTesting steps : 
 1. Testing steps :
 1. Install the module - Social Media Links Block and Field
 2. Add the block in block layout
 3. Add link to youtube , using url with multiple query parameters
 4. SaveMoving issue to RTBC++ 
- First commit to issue fork.
- Merge request !43Issue #3366866: Support URLs with multiple query parameters → (Merged) created by japerry
- Status changed to Fixedabout 1 year ago 8:57pm 26 August 2024
- 🇺🇸United States japerry KVUOUgh wish there were tests to verify its validity. but will need to come back to that. For now, merged! 
- Automatically closed - issue fixed for 2 weeks with no activity.