Skip to content

Commit

Permalink
Reuse 'Content-Disposition' header value
Browse files Browse the repository at this point in the history
Co-authored-by: Hugo Alliaume <[email protected]>
  • Loading branch information
smnandre and Kocal authored Jan 5, 2025
1 parent f81dcff commit 4f6f869
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/LiveComponent/assets/src/Component/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,11 @@ export default class Component {

const headers = backendResponse.response.headers;
if (headers.get('X-Live-Download')) {
const headerContentDisposition = headers.get('Content-Disposition');
if (
!(
headers.get('Content-Disposition')?.includes('attachment') ||
headers.get('Content-Disposition')?.includes('inline')
) ||
!headers.get('Content-Disposition')?.includes('filename=')
!headerContentDisposition
|| !(headerContentDisposition?.includes('attachment') || headerContentDisposition?.includes('inline'))
|| !headerContentDisposition?.includes('filename=')
) {
throw new Error('Invalid LiveDownload response');
}
Expand Down

0 comments on commit 4f6f869

Please sign in to comment.