Skip to content

Commit

Permalink
Prevent lang code to be included in URL for images
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTzonis committed Oct 21, 2024
1 parent f28af30 commit b71c455
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions includes/lib/transifex-live-integration-picker.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ function render() {
$source_url_path = (substr($url_path, 0, strlen($lang)) === $lang) ? substr($url_path, strlen($lang)) : $url_path;
}
$url_map = Transifex_Live_Integration_Common::generate_language_url_map( $source_url_path, $this->tokenized_url, $this->language_map );

// Ensure image URLs are not modified by the language prefix
foreach ($url_map as $key => $url) {
if (strpos($url, '/wp-content/uploads/') !== false) {
continue;
}
$url_map[$key] = rtrim($url, '/') . '/';
}
$site_url_slash_maybe = (new Transifex_Live_Integration_WP_Services())->get_site_url($this->is_subdirectory_install);
$site_url = rtrim( $site_url_slash_maybe, '/' ) . '/';
$source_url_path = ltrim( $source_url_path, '/' );
Expand Down

0 comments on commit b71c455

Please sign in to comment.