File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed
src/app/shared/media/media-store Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -127,10 +127,25 @@ export class MediaStore {
127127 await this . deleteThumbnail ( index ) ;
128128 return this . mutex . runExclusive ( async ( ) => {
129129 const extension = await this . getExtension ( index ) ;
130- await this . filesystemPlugin . deleteFile ( {
131- directory : this . directory ,
132- path : `${ this . rootDir } /${ index } .${ extension } ` ,
133- } ) ;
130+ try {
131+ await this . filesystemPlugin . deleteFile ( {
132+ directory : this . directory ,
133+ path : `${ this . rootDir } /${ index } .${ extension } ` ,
134+ } ) ;
135+ } catch ( error : any ) {
136+ /* WORKAROUND
137+ * In capture app we get "File does not exist error"
138+ * if currentPlatform.isAndroid() === true &&
139+ * fileToBeDeleted.isCapturedFromIphone() === true
140+ * When we delete capture from iPhone that was captured
141+ * by Android "File does not exists" is not thrown.
142+ * So we can silently ignore "File does not exist" error
143+ * while deleting capture from FileSystem only.
144+ */
145+ if ( error . message !== 'File does not exist' ) {
146+ throw error ;
147+ }
148+ }
134149 await this . deleteMediaExtension ( index ) ;
135150 return index ;
136151 } ) ;
You can’t perform that action at this time.
0 commit comments