@@ -124,7 +124,7 @@ function showTaskRollModal(options) {
124124 if ( ! task ) {
125125 return ;
126126 }
127- imageNode . src = task . image ;
127+ imageNode . src = resolveTaskImageSrc ( task . image ) ;
128128 nameNode . textContent = task . name ;
129129 const progress = total > 1 ? Math . min ( 100 , Math . floor ( ( index / ( total - 1 ) ) * 100 ) ) : 100 ;
130130 progressFill . style . width = `${ progress } %` ;
@@ -181,6 +181,16 @@ function isSpecialInstantRollUser() {
181181 return username === 'shadukat' || username === 'gerni shadu' ;
182182}
183183
184+ function resolveTaskImageSrc ( imageValue ) {
185+ if ( ! imageValue || typeof imageValue !== 'string' ) {
186+ return '/static/assets/Cake_of_guidance_detail.png' ;
187+ }
188+ if ( imageValue . startsWith ( '/static/' ) || imageValue . startsWith ( 'http://' ) || imageValue . startsWith ( 'https://' ) ) {
189+ return imageValue ;
190+ }
191+ return `/static/assets/${ imageValue } ` ;
192+ }
193+
184194$ ( document ) . on ( 'click' , '#start' , function ( ) {
185195 const startButton = document . getElementById ( 'start' ) ;
186196 const completeButton = document . getElementById ( 'complete' ) ;
@@ -204,7 +214,7 @@ $(document).on('click', '#start', function(){
204214 imageLink . href = task . link ;
205215 imageLink . setAttribute ( 'data-tip' , task . tip || '' ) ;
206216 message . innerHTML = task . name ;
207- image . src = task . image ;
217+ image . src = resolveTaskImageSrc ( task . image ) ;
208218 } ;
209219
210220 const sequence = buildRollSequence ( availableTasks , generatedTask ) ;
@@ -267,8 +277,9 @@ $(document).on('click', '#generate_unofficial', function(){
267277 imagePlaceholder . href = taskData . link || '#' ;
268278 imagePreview . name = taskData . name ;
269279 task . innerHTML = taskData . name ;
270- image . src = taskData . image ;
271- imagePreview . src = taskData . image ;
280+ const imageSrc = resolveTaskImageSrc ( taskData . image ) ;
281+ image . src = imageSrc ;
282+ imagePreview . src = imageSrc ;
272283 } ;
273284
274285 const sequence = buildRollSequence ( availableTasks , generatedTask ) ;
0 commit comments