Skip to content

Commit

Permalink
fix: do not dispatch in resume hook catch block
Browse files Browse the repository at this point in the history
- Removed the purgeUpload, as it's not clear if it would really be useful
in case of an unknown error
- Explicitely handle post-me not implemented error
In this case doing nothing is what's needed
  • Loading branch information
acezard committed Oct 24, 2023
1 parent f832b7f commit d545b04
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/drive/web/modules/views/Upload/useResumeFromFlagship.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ import { useClient } from 'cozy-client'
import { useWebviewIntent } from 'cozy-intent'
import logger from 'cozy-logger'

import {
getUploadQueue,
ADD_TO_UPLOAD_QUEUE,
purgeUploadQueue
} from 'drive/web/modules/upload'
import { getUploadQueue, ADD_TO_UPLOAD_QUEUE } from 'drive/web/modules/upload'
import { FileFromNative } from 'drive/web/modules/views/Upload/UploadTypes'
import { getErrorMessage } from 'drive/web/modules/drive/helpers'

Expand Down Expand Up @@ -39,8 +35,12 @@ export const useResumeUploadFromFlagship = (): void => {
files: filesToHandle
})
} catch (error) {
logger('info', `hasFilesToHandle error, ${getErrorMessage(error)}`)
dispatch(purgeUploadQueue())
const errorMessage = getErrorMessage(error)
logger('info', `hasFilesToHandle error, ${errorMessage}`)

// It means we're on a cozy-flagship version that doesn't handle file sharing
// In that case we don't want to do anything and just let the upload queue empty
if (errorMessage.includes('has not been implemented')) return
}
}

Expand Down

0 comments on commit d545b04

Please sign in to comment.