[wp-trac] [WordPress Trac] #2994: Theme files cannot be edited when theme's directory has brackets in it

WordPress Trac wp-trac at lists.automattic.com
Wed Aug 2 03:57:06 GMT 2006


#2994: Theme files cannot be edited when theme's directory has brackets in it
----------------------------+-----------------------------------------------
 Reporter:  trasnam         |       Owner:  anonymous           
     Type:  defect          |      Status:  new                 
 Priority:  normal          |   Milestone:                      
Component:  Administration  |     Version:  2.0.4               
 Severity:  normal          |    Keywords:  theme editor bracket
----------------------------+-----------------------------------------------
 Theme files cannot be edited when the theme name contains brackets in the
 directory name.  (For example themename[modification] .)

 After the upgrade to 2.0.4, I noticed I can no longer edit any theme
 files.  I get the error, "Sorry, that file cannot be edited." when I hit
 "Update File" on the theme-editor.php page for any arbitrary file.  This
 also occurs in 2.1 Alpha 2, but does not occur in 2.0.3.  Therefore, I
 believe it is a regression.

 After doing some debugging, I noticed that the value for the file I am
 editing is not the same in both '''$files''' and '''$allowed_files''' in
 admin-functions.php (only upon form submission, however).  The value in
 '''$files''' has the brackets stripped out, whereas the value in
 '''$allowed_files''' doesn't have the brackets stripped out.

 As a result of this, the function '''validate_file''' returns a 3, which
 in turn makes the function '''validate_file_to_edit''' return the "Sorry,
 that file cannot be edited." message.

 I haven't yet figured out what causes the brackets to get stripped out,
 and as such I have renamed the theme directory as a temporary workaround.

 I have no problem renaming the directory as a permanent fix, but I think
 the code should at least check for the brackets and tell the user to give
 the directory another name.  If not, it should handle the bracket just
 like any other text character without stripping it out.

 See this thread for more information:

 http://wordpress.org/support/topic/35201

-- 
Ticket URL: <http://trac.wordpress.org/ticket/2994>
WordPress Trac <http://wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list