- Notifications
You must be signed in to change notification settings - Fork 452
🐛(frontend) fix attachment download filename #1447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
616011c to 736c76a Compare | Size Change: +52 B (0%) Total Size: 3.66 MB
|
736c76a to 483730e Compare aa5294a to bb41aa1 Compare There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, works perfectly !
2 small comments.
I took the freedom to improve a bit our linter in this PR, it will highlight some fix that you will have to do, there are auto fixable.
| const unsafeName = baseName.includes('.') | ||
| ? baseName.replace(/(\.[^/.]+)$/, '-unsafe$1') | ||
| : baseName + '-unsafe'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const unsafeName = baseName.includes('.') | |
| ? baseName.replace(/(\.[^/.]+)$/, '-unsafe$1') | |
| : baseName + '-unsafe'; | |
| const regFindLastDot = /(\.[^/.]+)$/; | |
| const unsafeName = baseName.includes('.') | |
| ? baseName.replace(regFindLastDot, '-unsafe$1') | |
| : baseName + '-unsafe'; |
| await page.locator('.bn-block-content[data-content-type="pdf"]').click(); | ||
| | ||
| await page.locator('[data-test="downloadfile"]').click(); | ||
| | ||
| const download = await downloadPromise; | ||
| expect(download.suggestedFilename()).toBe('test-pdf.pdf'); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe not necessary to create a new test, could you maybe add this part in the test above (it embeds PDF) ?
Oh that's great 👍 ! |
c22b84b to 3e32128 Compare 0f90312 to 504109a Compare 504109a to cf3d526 Compare use the document title instead of the uuid when downloading attachments Signed-off-by: Cyril <c.gromoff@gmail.com>
Add no-unnecessary-type-assertion rule to eslint config to avoid automatically unnecessary type assertions in the codebase.
cf3d526 to 236c8df Compare
Purpose
Fix the filename used when downloading an attachment. Previously, the file was downloaded with its UUID, which was not user-friendly.
issue : 1413
Proposal