File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -127,16 +127,16 @@ export async function initCart(port: chrome.runtime.Port): Promise<void> {
127127
128128 try {
129129 importData = JSON . parse ( fileContent ) ;
130- if ( importData . tracks_export ) {
131- importType = 'json' ;
132- if ( importData . tracks_export . length === 0 ) {
133- showErrorMessage ( 'No items found in import file' ) ;
134- return ;
135- }
136- } else {
130+ if ( ! importData . tracks_export ) {
137131 showErrorMessage ( 'Invalid JSON format - missing tracks_export' ) ;
138132 return ;
139133 }
134+
135+ importType = 'json' ;
136+ if ( importData . tracks_export . length === 0 ) {
137+ showErrorMessage ( 'No items found in import file' ) ;
138+ return ;
139+ }
140140 } catch {
141141 const urls = fileContent
142142 . split ( '\n' )
@@ -163,9 +163,10 @@ export async function initCart(port: chrome.runtime.Port): Promise<void> {
163163
164164 if ( importType === 'json' ) {
165165 port . postMessage ( { cartImport : { items : importData . tracks_export } } ) ;
166- } else {
167- port . postMessage ( { cartUrlImport : { urls : importData } } ) ;
166+ return ;
168167 }
168+
169+ port . postMessage ( { cartUrlImport : { urls : importData } } ) ;
169170 } catch ( error ) {
170171 showErrorMessage ( 'Error loading file: ' + String ( error ) ) ;
171172 log . error ( 'Error importing: ' + String ( error ) ) ;
You can’t perform that action at this time.
0 commit comments