refactor: use minioIsDoesNotExist
This commit is contained in:
parent
82b24df1f0
commit
cadb18df7b
@ -33,11 +33,7 @@ sinkFile File{ fileContent = Just fileContentContent, .. } = do
|
||||
let uploadName = decodeUtf8 . Base64.encodeUnpadded $ ByteArray.convert fileContentHash
|
||||
uploadBucket <- getsYesod $ views appSettings appUploadCacheBucket
|
||||
unless inDB . runAppMinio $ do
|
||||
let isDoesNotExist :: HttpException -> Bool
|
||||
isDoesNotExist (HttpExceptionRequest _ (StatusCodeException resp _))
|
||||
= responseStatus resp == notFound404
|
||||
isDoesNotExist _ = False
|
||||
uploadExists <- handleIf isDoesNotExist (const $ return False) $ True <$ Minio.statObject uploadBucket uploadName Minio.defaultGetObjectOptions
|
||||
uploadExists <- handleIf minioIsDoesNotExist (const $ return False) $ True <$ Minio.statObject uploadBucket uploadName Minio.defaultGetObjectOptions
|
||||
unless uploadExists $ do
|
||||
let
|
||||
pooOptions = Minio.defaultPutObjectOptions
|
||||
|
||||
Reference in New Issue
Block a user