Skip to content

Commit

Permalink
Also validate in pstr pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
hasufell committed Dec 11, 2023
1 parent 1c7f639 commit 69141cb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions System/OsPath/Posix.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pstr =
lift ps
, quotePat = \s -> do
osp' <- either (fail . show) pure . encodeWith (mkUTF8 ErrorOnCodingFailure) $ s
when (not $ isValid osp') $ fail ("filepath not valid: " ++ show osp')
[p|((==) osp' -> True)|]
, quoteType = \_ ->
fail "illegal QuasiQuote (allowed as expression or pattern only, used as a type)"
Expand Down
1 change: 1 addition & 0 deletions System/OsPath/Windows.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pstr =
lift ps
, quotePat = \s -> do
osp' <- either (fail . show) pure . encodeWith (mkUTF16le ErrorOnCodingFailure) $ s
when (not $ isValid osp') $ fail ("filepath not valid: " ++ show osp')
[p|((==) osp' -> True)|]
, quoteType = \_ ->
fail "illegal QuasiQuote (allowed as expression or pattern only, used as a type)"
Expand Down

0 comments on commit 69141cb

Please sign in to comment.