[wp-trac] [WordPress Trac] #21194: Delete attachment AJAX fails when EMPTY_TRASH_DAYS is set to 0 days

WordPress Trac wp-trac at lists.automattic.com
Sun Jul 8 18:31:09 UTC 2012


#21194: Delete attachment AJAX fails when EMPTY_TRASH_DAYS is set to 0 days
---------------------------+-----------------------------
 Reporter:  simonwheatley  |      Owner:
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Media          |    Version:
 Severity:  normal         |   Keywords:  dev-feedback
---------------------------+-----------------------------
 To replicate:

  1. Set ```EMPTY_TRASH_DAYS``` to 0 (zero) in ```wp-config.php```
  2. Edit a post
  3. Upload a file (e.g. image) through via the edit post screen
  4. Attempt to delete the file
  5. Get error ```“apple” has failed to upload. You do not have permission.
 Has your session expired?```

 The problem is that the JS is binding an AJAX call to the ```a.delete```
 element in ```handlers.dev.js```, but incorrectly specifying the action as
 ```trash-post``` rather than ```delete-attachment``` which is what the
 nonce action was set as.

 Possible solutions:

  * Either the nonce needs to be created with the ```trash-post``` action
 (seems wrong)
  * The class of the element needs to change so it doesn't attract the JS
 binding
  * The class of all current delete links should be renamed to ```trash```,
 which seems more accurate but it kind of a big thing which will probably
 introduce other bugs
  * Something I've not thought of…

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


More information about the wp-trac mailing list