@@ -51,7 +51,7 @@ instance Default UploadBundle where
51newtype SnapshotIdent = SnapshotIdent { unSnapshotIdent :: Text }
51newtype SnapshotIdent = SnapshotIdent { unSnapshotIdent :: Text }
52 deriving (Show, Eq, Ord, Hashable, IsString)
52 deriving (Show, Eq, Ord, Hashable, IsString)
54−uploadBundle :: UploadBundle -> Manager -> IO SnapshotIdent
54+uploadBundle :: UploadBundle -> Manager -> IO (SnapshotIdent, Maybe Text)
55uploadBundle UploadBundle {..} man = do
55uploadBundle UploadBundle {..} man = do
56 req1 <- parseUrl $ unpack $ unStackageServer ubServer ++ "/upload"
56 req1 <- parseUrl $ unpack $ unStackageServer ubServer ++ "/upload"
57 req2 <- formDataBody formData req1
57 req2 <- formDataBody formData req1
@@ -67,10 +67,10 @@ uploadBundle UploadBundle {..} man = do
68 res <- httpLbs req3 man
68 res <- httpLbs req3 man
69 case lookup "x-stackage-ident" $ responseHeaders res of
69 case lookup "x-stackage-ident" $ responseHeaders res of
70− Just snapid -> do
70+ Just snapid -> return
71+ ( SnapshotIdent $ decodeUtf8 snapid
71− forM_ (lookup "location" $ responseHeaders res) $ \loc ->
72+ , decodeUtf8 <$> lookup "location" (responseHeaders res)
72− putStrLn $ "Check upload progress at: " ++ decodeUtf8 loc
73+ )
73− return $ SnapshotIdent $ decodeUtf8 snapid
74 Nothing -> error $ "An error occurred: " ++ show res
74 Nothing -> error $ "An error occurred: " ++ show res
76 params = mapMaybe (\(x, y) -> (x, ) <$> y)
76 params = mapMaybe (\(x, y) -> (x, ) <$> y)