Make WordPress Core

Opened 14 years ago

Closed 12 years ago

#11969 closed defect (bug) (fixed)

Theme-Editor - Relocates to a URL containing full path after a change is saved.

Reported by: rocketshelley's profile rocketshelley Owned by: matdumsa's profile matdumsa
Milestone: 3.4 Priority: low
Severity: normal Version: 2.9.2
Component: Administration Keywords: has-patch
Focuses: Cc:

Description

Hello,
First time reporting a bug, I didn't find this when searching...
When I am using the theme editor I am returned to a different URL after clicking the "Update File" button, which requires me to use my browser's back button to return to the theme editor. All my plugins have been disabled and this first started happening after upgrading to 2.9.1

when editing a theme file my url is:

http://www.mysite.com/wp-admin/theme-editor.php?file=/themes/mytheme/sidebar.php

after clicking the update file button it sends me here:

http://www.mysite.com/wp-admin/theme-editor.php?file=/home/user/public_html/mysite.com/wp-content/themes/mytheme/sidebar.php

Attachments (2)

theme-editor.diff (1.8 KB) - added by matdumsa 14 years ago.
Path for this Ticket.. This patch was made from rev:13795
theme-editor.2.diff (2.9 KB) - added by scribu 14 years ago.
use add_query_arg()

Download all attachments as: .zip

Change History (14)

#1 @rocketshelley
14 years ago

  • Component changed from General to Administration

#2 @scribu
14 years ago

  • Milestone changed from Unassigned to 3.0

#3 @matdumsa
14 years ago

  • Keywords needs-patch added
  • Owner set to matdumsa
  • Priority changed from normal to low
  • Status changed from new to accepted
  • Version changed from 2.9.1 to 2.9.2

I confirm the same happens with my 2.9.2 but on mine it doesn’t break the feature so I do not need to use the BACK button. I will try to work on a patch for this.

@matdumsa
14 years ago

Path for this Ticket.. This patch was made from rev:13795

#4 @matdumsa
14 years ago

  • Keywords has-patch added; needs-patch removed
  • Summary changed from Edit/Updating Theme Files different URLs to Theme-Editor - Relocates to a URL containing full path after a change is saved.

Ok, I think I got this one down!

@scribu
14 years ago

use add_query_arg()

#5 @scribu
14 years ago

  • Keywords commit added

Looks good. I've updated your patch to use add_query_arg(), which is easier to read.

#6 @nacin
14 years ago

See also #12843, [13994] for why this is happening in 2.9.

#7 follow-up: @nacin
14 years ago

Is the only purpose here to move the dir to the end of the URL, so the URL better reflects the file being edited?

#8 in reply to: ↑ 7 @ocean90
14 years ago

Replying to nacin:

Is the only purpose here to move the dir to the end of the URL, so the URL better reflects the file being edited?

No, it should fix the file parameter.
Before saving:

localhost/wp/wp-admin/theme-editor.php?file=/themes/twentyten/404.php&theme=Twenty+Ten&dir=theme

After saving:
localhost/wp/wp-admin/theme-editor.php?file=H:\xampplite\htdocs\wp/wp-content/themes/twentyten/404.php&theme=Twenty+Ten&a=te&scrollto=0

The Reporter said, that this breaks his plugins, but for scribu and me it breaks nothing. Maybe it's fixed through [13994].

#9 @nacin
14 years ago

  • Keywords commit removed
  • Milestone changed from 3.0 to 3.1

These paths became absolute in 2.9 because we added the ability to register a theme directory. While this is technically a regression, I'm not inclined to potentially break custom theme directories at this stage, and would rather move this to 3.1.

I don't believe the reporter said it broke his plugins, only his back button (and that he had no plugins enabled). Also, [13994] didn't fix this.

#10 @nacin
14 years ago

  • Milestone changed from Awaiting Triage to Future Release

#11 @MikeHansenMe
12 years ago

  • Keywords close added

I do not think this is a problem any longer. When I edit a file using the editor I am at url :

http://localhost/wp/wp-admin/theme-editor.php?file=style.css&theme=blank[[BR]]

After submitting changes I end on

http://localhost/wp/wp-admin/theme-editor.php?file=style.css&theme=blank&scrollto=0&updated=true[[BR]]

Proposing we close this ticket.

#12 @SergeyBiryukov
12 years ago

  • Keywords close removed
  • Milestone changed from Future Release to 3.4
  • Resolution set to fixed
  • Status changed from accepted to closed

Fixed in [20313].

Note: See TracTickets for help on using tickets.