Welcome, Guest! Log In | Create Account

Ticket #745 (closed defect: fixed)

Opened 5 months ago

Last modified 4 months ago

Changing the internet address for your current page leads to 404

Reported by: bharat Owned by: tnalmdal
Priority: minor Milestone: 3.0 RC 1
Version: 3.0 Beta 2 Keywords:
Cc: jankoprowski

Description

Steps to reproduce
1) Go into an album
2) Choose "Edit Album" from the "Album Options" dropdown
3) Modify the Internet Address field
4) Save
--> 404

We need to redirect you to the new page. But we need to do it in a way that works both from the Album/Photo Options dropdown as well as from the context menu.

Attachments

0001-745.patch (3.5 KB) - added by jankoprowski 5 months ago.
Proposal solution using refferer

Change History

Changed 5 months ago by jankoprowski

  • owner set to jankoprowski
  • status changed from new to accepted

Changed 5 months ago by jankoprowski

One huge problem is here. Proposed solution:

modules/gallery/controllers/albums.php:_update()

      $url_changed = $previous_album_url != $album->url();
      $watching_album = Router::$controller == 'albums' && Router::$method == $album->id;
      if ($url_changed && $watching_album) {
        print json_encode(
          array("result" => "success",
                "location" => $album->url(),
                "resource" => $album->url()));
      } else {
        print json_encode(
          array("result" => "success"));
      }
    } else {
      print json_encode(
        array("result" => "error",
              "form" => $form->__toString()));
    }

but $watching_album doesn't work because for some reasons codition Router::$method == $album->id is always true. When I get http://localhost/gallery3/index.php and from here edit album (id = 2) Router::$method in _update show 2 (not 1) :/

Second thing. Analogical problems is with editing/redirecting photos.

Changed 5 months ago by jankoprowski

  • owner jankoprowski deleted
  • status changed from accepted to assigned

Changed 5 months ago by jankoprowski

  • cc jankoprowski added

Changed 5 months ago by jankoprowski

I solve the problem witch nasty way using refferer. I can't find better way.
Question is

$last_page = parse_url(request::referrer(), PHP_URL_PATH);

is not a good destiny for helper get_last_page_path() or something similar.

Changed 5 months ago by jankoprowski

Proposal solution using refferer

Changed 5 months ago by bharat

#761 is a duplicate of this

Changed 5 months ago by jankoprowski

  • owner set to bharat

Changed 5 months ago by ocellated

The same issue (404) happens when giving a new internet address from an individual photo page as well. It's not limited to just renaming albums. Didn't think this was worthy of a separate ticket in trac...

Changed 5 months ago by jankoprowski

IMHO patch fix photos too.

Changed 4 months ago by tnalmdal

  • owner changed from bharat to tnalmdal

When an album or photo is updated always return the photo/album location as part of the response. This insures that if the internet address changes, then the page will reload properly. - http://bit.ly/4vKwFx

Changed 4 months ago by tnalmdal

  • status changed from assigned to closed
  • resolution set to fixed

Changed 4 months ago by tnalmdal

  • status changed from closed to reopened
  • resolution fixed deleted

doesn't work well from the context menu

Changed 4 months ago by tnalmdal

  • status changed from reopened to closed
  • resolution set to fixed

Use the request::referrer to determine if we are editting the photo or album from the context menu or from its photo or album page. Thanks to jankoprowski for the referrer approach.

http://bit.ly/26cw7t

Note: See TracTickets for help on using tickets.