Skip to content

Commit

Permalink
add catchError on HEAD request
Browse files Browse the repository at this point in the history
  • Loading branch information
ebrehault committed Mar 18, 2024
1 parent d50389b commit fa2a931
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { TextField } from '@nuclia/core';
import { Observable, from, map, of, switchMap, tap } from 'rxjs';
import { Observable, catchError, from, map, of, switchMap, tap } from 'rxjs';

import { EVENTS } from '../../../../events/events';
import { eventEmitter } from '../../../../server';
Expand Down Expand Up @@ -107,6 +107,7 @@ export class SyncSingleFile implements SyncSingleFileUseCase {
try {
return from(fetch(url, { method: 'HEAD' })).pipe(
map((response) => (response.headers.get('content-type') || 'text/html').split(';')[0]),
catchError(() => of('text/html')),
);
} catch (err) {
return of('text/html');
Expand Down

0 comments on commit fa2a931

Please sign in to comment.