From cadb18df7bcbe848dac1d8a89507a02636ad82ea Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 17 Jul 2020 09:25:11 +0200 Subject: [PATCH] refactor: use minioIsDoesNotExist --- src/Utils/Files.hs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Utils/Files.hs b/src/Utils/Files.hs index 71fb968a2..e171dba0d 100644 --- a/src/Utils/Files.hs +++ b/src/Utils/Files.hs @@ -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