Skip to content
Browse files

Fix g2_import::g2_url() to only replace the $g2_base_url once at the

beginning of the url string.  Also, only do this when we're about to
put it into the map, not when we're getting the g2 url else the url is
mangled for other purposes.  Fixes #1512.
  • Loading branch information...
1 parent 95eb113 commit 2ad0cba4cd1b757fd652e36adf0bd9b9035b2326 @bharat bharat committed
Showing with 6 additions and 2 deletions.
  1. +6 −2 modules/g2_import/helpers/g2_import.php
View
8 modules/g2_import/helpers/g2_import.php
@@ -1200,6 +1200,11 @@ static function set_map($g2_id, $g3_id, $resource_type, $g2_url=null) {
$g2_map->g3_id = $g3_id;
$g2_map->g2_id = $g2_id;
$g2_map->resource_type = $resource_type;
+
+ if (strpos($g2_url, self::$g2_base_url) === 0) {
+ $g2_url = substr($g2_url, strlen(self::$g2_base_url));
+ }
+
$g2_map->g2_url = $g2_url;
$g2_map->save();
self::$map[$g2_id] = $g3_id;
@@ -1212,13 +1217,12 @@ static function log($msg) {
static function g2_url($params) {
global $gallery;
- $url = $gallery->getUrlGenerator()->generateUrl(
+ return $gallery->getUrlGenerator()->generateUrl(
$params,
array("forceSessionId" => false,
"htmlEntities" => false,
"urlEncode" => false,
"useAuthToken" => false));
- return str_replace(self::$g2_base_url, "", $url);
}
static function lower_error_reporting() {

0 comments on commit 2ad0cba

Please sign in to comment.
Something went wrong with that request. Please try again.