From 44b178831c8c6bd388c74bce5a9ccfae7e9c2287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Wed, 9 Apr 2025 22:11:18 +0200 Subject: Check that range argument parts are not empty --- src/Command/Run.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/Command/Run.hs') diff --git a/src/Command/Run.hs b/src/Command/Run.hs index 068f3a2..e117c57 100644 --- a/src/Command/Run.hs +++ b/src/Command/Run.hs @@ -238,11 +238,15 @@ cmdRun (RunCommand RunOptions {..} args) = do ( rangeOptions, jobOptions ) <- partitionEithers . concat <$> sequence [ forM roRanges $ \range -> case T.splitOn ".." range of - [ base, tip ] -> return $ Left ( Just base, tip ) + [ base, tip ] + | not (T.null base) && not (T.null tip) + -> return $ Left ( Just base, tip ) _ -> tfail $ "invalid range: " <> range , forM roSinceUpstream $ return . Left . ( Nothing, ) , forM args $ \arg -> case T.splitOn ".." arg of - [ base, tip ] -> return $ Left ( Just base, tip ) + [ base, tip ] + | not (T.null base) && not (T.null tip) + -> return $ Left ( Just base, tip ) [ _ ] -> return $ Right $ JobName arg _ -> tfail $ "invalid argument: " <> arg ] -- cgit v1.2.3