Skip to content

Commit 033d5be

Browse files
committed
wip
1 parent 2afbc1e commit 033d5be

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

packages/expo-resource-fetcher/src/ResourceFetcherUtils.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,13 @@ export namespace ResourceFetcherUtils {
6767
previousFilesTotalLength: number;
6868
}> = [];
6969
let totalLength = 0;
70-
let previousFilesTotalLength = 0;
70+
7171
for (const source of sources) {
7272
const type = ResourceFetcherUtils.getType(source);
7373
let length = 0;
74-
try {
75-
if (type === SourceType.REMOTE_FILE && typeof source === 'string') {
74+
75+
if (type === SourceType.REMOTE_FILE && typeof source === 'string') {
76+
try {
7677
const response = await fetch(source, { method: 'HEAD' });
7778
if (!response.ok) {
7879
Logger.warn(
@@ -87,16 +88,17 @@ export namespace ResourceFetcherUtils {
8788
}
8889

8990
length = contentLength ? parseInt(contentLength, 10) : 0;
90-
previousFilesTotalLength = totalLength;
91-
totalLength += length;
91+
} catch (error) {
92+
Logger.warn(`Error fetching HEAD for ${source}:`, error);
93+
continue;
9294
}
93-
} catch (error) {
94-
Logger.warn(`Error fetching HEAD for ${source}:`, error);
95-
continue;
96-
} finally {
97-
results.push({ source, type, length, previousFilesTotalLength });
9895
}
96+
97+
const previousFilesTotalLength = totalLength;
98+
totalLength += length;
99+
results.push({ source, type, length, previousFilesTotalLength });
99100
}
101+
100102
return { results, totalLength };
101103
}
102104

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from './ResourceFetcher';
1+
export * from './ResourceFetcherV2';

0 commit comments

Comments
 (0)