@@ -140,6 +140,8 @@ export default async function PublishPlugin({ mode = 'publish', id }) {
140140
141141 function onerror ( error ) {
142142 errorText . value = error ;
143+ submitButton . el . disabled = true ;
144+ submitButton . el . ariaDisabled = true ;
143145 }
144146
145147 function onFileChange ( ) {
@@ -155,27 +157,35 @@ export default async function PublishPlugin({ mode = 'publish', id }) {
155157 pluginPrice . value = '' ;
156158 pluginIcon . src = '#' ;
157159 minVersionCode . value = '' ;
160+ submitButton . el . disabled = true ;
161+ submitButton . el . ariaDisabled = true ;
158162 return ;
159163 }
160164
161165 const reader = new FileReader ( ) ;
166+ submitButton . el . disabled = false ;
167+ submitButton . el . ariaDisabled = false ;
162168
163169 reader . onload = async ( ) => {
164170 showLoading ( ) ;
165171 const zip = await jsZip . loadAsync ( reader . result ) ;
166172 try {
167173 const manifest = JSON . parse ( await zip . file ( 'plugin.json' ) . async ( 'string' ) ) ;
168- const icon = await zip . file ( 'icon.png' ) . async ( 'base64' ) ;
174+ const iconFileFromManifest = manifest ?. icon || 'icon.png' ;
175+ const icon = await zip . file ( iconFileFromManifest ) ?. async ( 'base64' ) ;
169176
170177 if ( id && id !== manifest . id ) {
171178 throw new Error ( 'Plugin ID is not same as previous version.' ) ;
172179 }
173180
174181 if ( id && ! isVersionGreater ( manifest . version , plugin . version ) ) {
175182 submitButton . el . disabled = true ;
183+ submitButton . el . ariaDisabled = true ;
176184 throw new Error ( 'Version should be greater than previous version.' ) ;
177185 }
178186
187+ if ( ! icon ) errorText . value = 'Unable to load plugin icon: no icon was provided or the default icon (icon.png) is missing.' ;
188+
179189 const changelogs = ( await zip . file ( 'changelogs.md' ) ?. async ( 'string' ) ) || ( await zip . file ( 'changelog.md' ) ?. async ( 'string' ) ) ;
180190
181191 if ( changelogs ) {
@@ -220,6 +230,12 @@ export default async function PublishPlugin({ mode = 'publish', id }) {
220230 pluginName . value = manifest . name ;
221231 pluginVersion . value = manifest . version ;
222232 minVersionCode . value = manifest . minVersionCode || - 1 ;
233+ // Checking for icon before rendering
234+ if ( ! icon ) {
235+ submitButton . el . disabled = true ;
236+ submitButton . el . ariaDisabled = true ;
237+ throw new Error ( 'Unable to load plugin icon: no icon was provided or the default icon (icon.png) is missing.' ) ;
238+ }
223239 pluginIcon . src = `data:image/png;base64,${ icon } ` ;
224240
225241 errorText . value = '' ;
0 commit comments