{"action":"created","issue":{"url":"https://api.github.com/repos/woothemes/woocommerce/issues/8976","labels_url":"https://api.github.com/repos/woothemes/woocommerce/issues/8976/labels{/name}","comments_url":"https://api.github.com/repos/woothemes/woocommerce/issues/8976/comments","events_url":"https://api.github.com/repos/woothemes/woocommerce/issues/8976/events","html_url":"https://github.com/woothemes/woocommerce/issues/8976","id":103600865,"number":8976,"title":"Old order download links broken","user":{"login":"douglsmith","id":2446310,"avatar_url":"https://avatars.githubusercontent.com/u/2446310?v=3","gravatar_id":"","url":"https://api.github.com/users/douglsmith","html_url":"https://github.com/douglsmith","followers_url":"https://api.github.com/users/douglsmith/followers","following_url":"https://api.github.com/users/douglsmith/following{/other_user}","gists_url":"https://api.github.com/users/douglsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/douglsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/douglsmith/subscriptions","organizations_url":"https://api.github.com/users/douglsmith/orgs","repos_url":"https://api.github.com/users/douglsmith/repos","events_url":"https://api.github.com/users/douglsmith/events{/privacy}","received_events_url":"https://api.github.com/users/douglsmith/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/woothemes/woocommerce/labels/Needs%20Reporter%20Feedback","name":"Needs Reporter Feedback","color":"444444"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-08-27T21:39:12Z","updated_at":"2015-09-02T09:36:00Z","closed_at":"2015-09-02T09:36:00Z","body":"I've gotten occasional customer complaints about download links on older orders not working from the _My Account_ page for a long time. I finally took the time to investigate and collect the details of the problem.\r\n\r\nThe bad links are in this form. Note that the key parameter is missing. (If it matters, these are all downloads set up using the Amazon S3 extension shortcode.)\r\n\r\n`https://example.com/?download_file=766&order=order_509193a262381&email=redacted@hotmail.com&key`\r\n\r\nIf I edit an order and re-send the _Completed order_ e-mail, that message has a working download link in it.\r\n\r\nThe orders actually have two rows for the product in the _Downloadable Product Permissions_ section.\r\n\r\n<img width=\"937\" alt=\"pastedgraphic-5\" src=\"https://cloud.githubusercontent.com/assets/2446310/9531751/4532032a-4ccd-11e5-9b9d-2466e79d9e54.png\">\r\n \r\nI see the two records in the database `woocommerce_downloadable_product_permissions` table as well. The older one has a blank or 0 value  in the `download_id` column.\r\n\r\n<img width=\"1311\" alt=\"pastedgraphic-9\" src=\"https://cloud.githubusercontent.com/assets/2446310/9531912/0acddea6-4cce-11e5-9c77-f97a9f60532a.png\">\r\n\r\nBased on the seeing a large number of records with the same date, I believe the additional records were created by a WooCommerce update. The dates would be consistent with my upgrade to the WooCommerce 2.0.x series, which did change how downloads were handled. I have no idea if the links were a problem back then, though; only that they are broken now.\r\n\r\nI determined through experimentation that the _My Account_ page links are pulled from the first database record that is encountered. Even though there is a newer, correct record, that isn't used.\r\n\r\nHowever, e-mailed order receipts use the more recent record so they have a working link.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/woothemes/woocommerce/issues/comments/136998793","html_url":"https://github.com/woothemes/woocommerce/issues/8976#issuecomment-136998793","issue_url":"https://api.github.com/repos/woothemes/woocommerce/issues/8976","id":136998793,"user":{"login":"mikejolley","id":90977,"avatar_url":"https://avatars.githubusercontent.com/u/90977?v=3","gravatar_id":"","url":"https://api.github.com/users/mikejolley","html_url":"https://github.com/mikejolley","followers_url":"https://api.github.com/users/mikejolley/followers","following_url":"https://api.github.com/users/mikejolley/following{/other_user}","gists_url":"https://api.github.com/users/mikejolley/gists{/gist_id}","starred_url":"https://api.github.com/users/mikejolley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikejolley/subscriptions","organizations_url":"https://api.github.com/users/mikejolley/orgs","repos_url":"https://api.github.com/users/mikejolley/repos","events_url":"https://api.github.com/users/mikejolley/events{/privacy}","received_events_url":"https://api.github.com/users/mikejolley/received_events","type":"User","site_admin":false},"created_at":"2015-09-02T09:36:00Z","updated_at":"2015-09-02T09:36:00Z","body":"Good to hear. I cannot trace back why this happened; as a said the updater should have done an 'update'. But as it's legacy I'll just keep an eye for more reports in the future. Sorry about the trouble."}}