Ticket #5553 (assigned defect (bug))

Opened 1 year ago

Last modified 1 year ago

add_rewrite_endpoint does not work for attachments

Reported by: Curioso Assigned to: westi (accepted)
Priority: normal Milestone: 2.9
Component: General Version:
Severity: normal Keywords: has-patch, needs-testing
Cc:

Description

The functionality for adding endpoints in rewrite rules does not work for attachments. In wp-includes/rewrite.php:

                    //do endpoints for attachments
                    if ($endpoint) { foreach ($ep_query_append as $regex => $ep) {
                        if ($ep[0] & EP_ATTACHMENT) {
                            $rewrite[$sub1 . $regex] = $subquery . '?' . $ep[1] . $this->preg_index(2);
                            $rewrite[$sub2 . $regex] = $subquery . '?' . $ep[1] . $this->preg_index(2);
                        }
                    } }                                                                                              

should be:

                    //do endpoints for attachments
                    if ($endpoints) { foreach ($ep_query_append as $regex => $ep) {
                        if ($ep[0] & EP_ATTACHMENT) {
                            $rewrite[$sub1 . $regex] = $subquery . $ep[1] . $this->preg_index(2);
                            $rewrite[$sub2 . $regex] = $subquery . $ep[1] . $this->preg_index(2);
                        }
                    } }                                                                                              

Note the typing error in $endpoints, and the '?' is already present in $subquery.

Attachments

5553.diff (0.8 kB) - added by lloydbudd on 01/02/08 22:32:22.
created diff based on code in Description. untested.

Change History

12/31/07 14:11:21 changed by westi

  • keywords set to needs-patch.
  • owner changed from anonymous to westi.
  • status changed from new to assigned.
  • milestone changed from 2.5 to 2.4.

01/02/08 22:31:38 changed by lloydbudd

  • summary changed from add_rewrite_endpoint does not work to add_rewrite_endpoint does not work for attachments.

01/02/08 22:32:22 changed by lloydbudd

  • attachment 5553.diff added.

created diff based on code in Description. untested.

01/06/08 21:29:46 changed by ffemtcj

  • keywords changed from needs-patch to has-patch, needs-testing.