# Bug OP-8191 - PDF export opens in same tab

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-8191

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module |  |
| Target versions | 11.2.0 |
| Observed in versions | 11.1.0 |
| Sprint | 11.2.0 |
| Backlog bucket |  |
| Bug found in version (deprecated) | 11.1.x |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers |  |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

### **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

  - This issue doesn't happen on localhost
  - 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>
  - The download link attribute doesn't work with CORS: <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.
