@@ -68,7 +68,9 @@ export class HttpSpacePrimitives implements SpacePrimitives {
6868 if ( isWebKit ) {
6969 url = encodeExtensionDot ( url ) ;
7070 }
71- options . signal = AbortSignal . timeout ( fetchTimeout ) ;
71+ if ( fetchTimeout > 0 ) {
72+ options . signal = AbortSignal . timeout ( fetchTimeout ) ;
73+ }
7274 options . redirect = "manual" ;
7375 const result = await fetch ( url , options ) ;
7476 if ( result . status >= 500 && result . status < 600 ) {
@@ -129,6 +131,12 @@ export class HttpSpacePrimitives implements SpacePrimitives {
129131 }
130132 return result ;
131133 } catch ( e : any ) {
134+ // AbortSignal.timeout() throws a DOMException with name "TimeoutError".
135+ // This is NOT an offline condition — the network may be fine, just slow.
136+ if ( e . name === "TimeoutError" ) {
137+ console . warn ( "Request timed out for" , url ) ;
138+ throw new Error ( `Request timed out after ${ fetchTimeout } ms` ) ;
139+ }
132140 // Errors when there is no internet connection:
133141 //
134142 // * Firefox: NetworkError when attempting to fetch resource (with SW and without)
@@ -218,6 +226,7 @@ export class HttpSpacePrimitives implements SpacePrimitives {
218226 // Casting to any due to TypeScript fetch type limitations
219227 body : data as any ,
220228 } ,
229+ 0 , // No timeout for uploads — transfer time depends on file size and connection speed
221230 ) ;
222231 return headersToFileMeta ( path , res . headers ) ! ;
223232 }
0 commit comments