Igor Gariev (gariev) wrote in changelog,
Igor Gariev
gariev
changelog

[livejournal] r18729: LJSUP-8414: URL is incorrect to some jou...

Committer: gariev
LJSUP-8414: URL is incorrect to some journals

U   trunk/cgi-bin/weblib.pl
Modified: trunk/cgi-bin/weblib.pl
===================================================================
--- trunk/cgi-bin/weblib.pl	2011-03-29 06:00:26 UTC (rev 18728)
+++ trunk/cgi-bin/weblib.pl	2011-03-29 08:44:09 UTC (rev 18729)
@@ -2191,12 +2191,18 @@
 
     my $mobile_link = '';
     if (!$LJ::DISABLED{'view_mobile_link_always'} || Apache::WURFL->is_mobile()) {
+        my $proto = $LJ::IS_SSL ? "https://" : "http://";
+        my $hostname = LJ::Request->hostname;
         my $uri = LJ::Request->uri;
-        my $hostname = LJ::Request->hostname;
         my $args = LJ::Request->args;
         my $args_wq = $args ? "?$args" : "";
-        my $is_ssl = $LJ::IS_SSL = LJ::run_hook("ssl_check");
-        my $proto = $is_ssl ? "https://" : "http://";
+        
+        ## HACK: remote __rpc_ (endpoint) part and all arguments
+        ## TODO: more intelligent page address (Referer?) for AJAX requests
+        if ($uri =~ s/__rpc_.*$//) {
+            $args_wq = '';
+        }
+
         my $url = LJ::eurl ($proto.$hostname.$uri.$args_wq);
         $mobile_link .= "<div class='b-message-mobile'><div class='b-message-mobile-wrapper'>";
         $mobile_link .= LJ::Lang::ml('link.mobile', { href => "href='http://m.livejournal.com/redirect?from=$url'" });

Tags: gariev, livejournal, pl
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments