Content
View differences
Updated by Aleix Suau over 5 years ago
### **Environment**:
OpenProject 11.1.2
### **Steps to reproduce:**
1. Go to work package page.
2. Export work package list as PDF.
### **Actual Behavior**
PDF is directly opened in current tab, therefore context gets lost.
### **Expected Behavior**
PDF is opened in separate tab.
### Development Notes
* In order to get the PDF we generate dynamically a link with the url that we get from \[domain\]/api/v3/job\_statuses/\[jobId\] (response.download)
* The url ([/api/v3/attachments/2506/content](https://qa.openproject-edge.com/api/v3/attachments/2506/content)) redirects to the file in Amazon: [https://openproject-edge-com-data.s3.eu-west-1.amazonaws.com/qa/attachment/file/2506/AAA\_project\_-\_Work\_packages.pdf?response-content-disposition=inline&X-Amz-Expires=21600&X-Amz-Date=20210209T052620Z&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIEUPDBQ7SZPYD4TA%2F20210209%2Feu-west-1%2Fs3%2Faws4\_request&X-Amz-SignedHeaders=host&X-Amz-Signature=7a6525bc7f90eccb2b8d60b19a2ddd90eaf6c4371f2bf6730ce5532320eceacc](https://openproject-edge-com-data.s3.eu-west-1.amazonaws.com/qa/attachment/file/2506/AAA_project_-_Work_packages.pdf?response-content-disposition=inline&X-Amz-Expires=21600&X-Amz-Date=20210209T052620Z&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIEUPDBQ7SZPYD4TA%2F20210209%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-SignedHeaders=host&X-Amz-Signature=7a6525bc7f90eccb2b8d60b19a2ddd90eaf6c4371f2bf6730ce5532320eceacc) [https://openproject-edge-com-data.s3.eu-west-1.amazonaws.com/qa/attachment/file/2506/AAA\_project\_-\_Work\_packages.pdf?response-content-disposition=inline&X-Amz-Expires=21600&X-Amz-Date=20210209T052620Z&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIEUPDBQ7SZPYD4TA%2F20210209%2Feu-west-1%2Fs3%2Faws4\_request&X-Amz-SignedHeaders=host&X-Amz-Signature=7a6525bc7f90eccb2b8d60b19a2ddd90eaf6c4371f2bf6730ce5532320eceacc](https://openproject-edge-com-data.s3.eu-west-1.amazonaws.com/qa/attachment/file/2506/AAA_project_-_Work_packages.pdf?response-content-disposition=inline&X-Amz-Expires=21600&X-Amz-Date=20210209T052620Z&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIEUPDBQ7SZPYD4TA%2F20210209%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-SignedHeaders=host&X-Amz-Signature=7a6525bc7f90eccb2b8d60b19a2ddd90eaf6c4371f2bf6730ce5532320eceacc)
* The download link attribute doesn't work with CORS: [https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-download](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-download) [https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-download](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-download)
* The \_blank attribute neither
* Possible solution: Adding the Amazon url of the file to the href of the link seems to work.
### Questions
* How do we emulate pdfs donwload on localhost?
* How does the pull preview work? CORS blocks testing against qa pdfs.
OpenProject 11.1.2
### **Steps to reproduce:**
1. Go to work package page.
2. Export work package list as PDF.
### **Actual Behavior**
PDF is directly opened in current tab, therefore context gets lost.
### **Expected Behavior**
PDF is opened in separate tab.
### Development Notes
* In order to get the PDF we generate dynamically a link with the url that we get from \[domain\]/api/v3/job\_statuses/\[jobId\] (response.download)
* The url ([/api/v3/attachments/2506/content](https://qa.openproject-edge.com/api/v3/attachments/2506/content)) redirects to the file in Amazon: [https://openproject-edge-com-data.s3.eu-west-1.amazonaws.com/qa/attachment/file/2506/AAA\_project\_-\_Work\_packages.pdf?response-content-disposition=inline&X-Amz-Expires=21600&X-Amz-Date=20210209T052620Z&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIEUPDBQ7SZPYD4TA%2F20210209%2Feu-west-1%2Fs3%2Faws4\_request&X-Amz-SignedHeaders=host&X-Amz-Signature=7a6525bc7f90eccb2b8d60b19a2ddd90eaf6c4371f2bf6730ce5532320eceacc](https://openproject-edge-com-data.s3.eu-west-1.amazonaws.com/qa/attachment/file/2506/AAA_project_-_Work_packages.pdf?response-content-disposition=inline&X-Amz-Expires=21600&X-Amz-Date=20210209T052620Z&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIEUPDBQ7SZPYD4TA%2F20210209%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-SignedHeaders=host&X-Amz-Signature=7a6525bc7f90eccb2b8d60b19a2ddd90eaf6c4371f2bf6730ce5532320eceacc)
* The download link attribute doesn't work with CORS: [https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-download](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-download)
* The \_blank attribute neither
* Possible solution: Adding the Amazon url of the file to the href of the link seems to work.
### Questions
* How do we emulate pdfs donwload on localhost?
* How does the pull preview work? CORS blocks testing against qa pdfs.