File tree Expand file tree Collapse file tree 1 file changed +12
-19
lines changed
packages/imagekit-editor-dev/src/components Expand file tree Collapse file tree 1 file changed +12
-19
lines changed Original file line number Diff line number Diff line change @@ -55,8 +55,8 @@ const baseUrl = (url?: string) => {
5555export default function RetryableImage ( props : RetryableImageProps ) {
5656 const {
5757 src,
58- maxRetries = 3 ,
59- retryDelay = 1000 ,
58+ maxRetries = 10 ,
59+ retryDelay = 10000 ,
6060 onRetryExhausted,
6161 onRetry,
6262 nonRetryableStatusCodes = DEFAULT_NON_RETRYABLE ,
@@ -113,23 +113,16 @@ export default function RetryableImage(props: RetryableImageProps) {
113113 { ok : true } | { ok : false ; status ?: number ; message : string }
114114 > => {
115115 try {
116- // Prefer HEAD to avoid downloading body; fall back to GET if HEAD fails quickly
117- let res : Response | null = null
118- try {
119- res = await fetch ( String ( src ) , {
120- method : "HEAD" ,
121- cache : "no-cache" ,
122- signal,
123- } )
124- } catch {
125- // Some CDNs don't allow HEAD on images—fall back to GET
126- res = await fetch ( String ( src ) , {
127- method : "GET" ,
128- cache : "no-cache" ,
129- signal,
130- } )
131- }
132- if ( res . status !== 200 ) {
116+ const url = new URL ( String ( src ) )
117+
118+ url . searchParams . set ( "ik-version" , Date . now ( ) . toString ( ) )
119+
120+ const res = await fetch ( url . toString ( ) , {
121+ method : "GET" ,
122+ signal,
123+ } )
124+
125+ if ( ! res . headers . get ( "content-type" ) ?. includes ( "image" ) ) {
133126 return {
134127 ok : false ,
135128 status : res . status ,
You can’t perform that action at this time.
0 commit comments