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
|
let uploadName = decodeUtf8 . Base64.encodeUnpadded $ ByteArray.convert fileContentHash
|
||||||
uploadBucket <- getsYesod $ views appSettings appUploadCacheBucket
|
uploadBucket <- getsYesod $ views appSettings appUploadCacheBucket
|
||||||
unless inDB . runAppMinio $ do
|
unless inDB . runAppMinio $ do
|
||||||
let isDoesNotExist :: HttpException -> Bool
|
uploadExists <- handleIf minioIsDoesNotExist (const $ return False) $ True <$ Minio.statObject uploadBucket uploadName Minio.defaultGetObjectOptions
|
||||||
isDoesNotExist (HttpExceptionRequest _ (StatusCodeException resp _))
|
|
||||||
= responseStatus resp == notFound404
|
|
||||||
isDoesNotExist _ = False
|
|
||||||
uploadExists <- handleIf isDoesNotExist (const $ return False) $ True <$ Minio.statObject uploadBucket uploadName Minio.defaultGetObjectOptions
|
|
||||||
unless uploadExists $ do
|
unless uploadExists $ do
|
||||||
let
|
let
|
||||||
pooOptions = Minio.defaultPutObjectOptions
|
pooOptions = Minio.defaultPutObjectOptions
|
||||||
|
|||||||
Reference in New Issue
Block a user