Skip to content

Commit 4f6f869

Browse files
smnandreKocal
andauthored
Reuse 'Content-Disposition' header value
Co-authored-by: Hugo Alliaume <[email protected]>
1 parent f81dcff commit 4f6f869

File tree

1 file changed

+4
-5
lines changed
  • src/LiveComponent/assets/src/Component

1 file changed

+4
-5
lines changed

src/LiveComponent/assets/src/Component/index.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -308,12 +308,11 @@ export default class Component {
308308

309309
const headers = backendResponse.response.headers;
310310
if (headers.get('X-Live-Download')) {
311+
const headerContentDisposition = headers.get('Content-Disposition');
311312
if (
312-
!(
313-
headers.get('Content-Disposition')?.includes('attachment') ||
314-
headers.get('Content-Disposition')?.includes('inline')
315-
) ||
316-
!headers.get('Content-Disposition')?.includes('filename=')
313+
!headerContentDisposition
314+
|| !(headerContentDisposition?.includes('attachment') || headerContentDisposition?.includes('inline'))
315+
|| !headerContentDisposition?.includes('filename=')
317316
) {
318317
throw new Error('Invalid LiveDownload response');
319318
}

0 commit comments

Comments
 (0)