--- pathologic.module	Thu Jun 17 03:43:31 2010
+++ pathologic.module	Fri Sep 03 09:14:48 2010
@@ -99,6 +99,21 @@
  * Replace the attributes. preg_replace_callback() callback.
  */
 function _pathologic_replace($matches, $absolute) {
+  global $language;
+
+  // Find out whether language prefix is not desirable in a new URL - if it's
+  // a link to some media object which is usually within "src" attribute.
+  // See url() and language_url_rewrite().
+  if (drupal_strtolower($matches[1]) === 'src') {
+    // Don't language add prefix to URL
+    $language_option = drupal_clone($language);
+    $language_option->prefix = '';
+  }
+  else {
+    // Standard handling
+    $language_option = $language;
+  }
+
   // Build the full URL, then take it apart
   $parts = parse_url('http://example.com/' . urldecode($matches[3]));
   if ($parts['path'] === '/' | $parts['path'] === '//') {
@@ -121,7 +136,7 @@
   else {
     $qparts = array();
   }
-  return $matches[1] . '="' . url($parts['path'], array('query' => $qparts, 'fragment' => isset($parts['fragment']) ? $parts['fragment'] : NULL, 'absolute' => $absolute)) . '"';
+  return $matches[1] . '="' . url($parts['path'], array('query' => $qparts, 'fragment' => isset($parts['fragment']) ? $parts['fragment'] : NULL, 'absolute' => $absolute, 'language' => $language_option)) . '"';
 }
 
 
