deal with attempt to export filename with # or ? to webdav
xporting files with '#' or '?' in their name won't work because urls get truncated on those. Fail in a better way in this case, and avoid failing when removing such files from the export, so after the user has renamed the problem files the export will succeed.
This commit is contained in:
parent
d5c435d3dc
commit
60c1b5c994
5 changed files with 78 additions and 26 deletions
|
@ -46,8 +46,14 @@ keyDir k = addTrailingPathSeparator $ hashdir </> keyFile k
|
|||
keyLocation :: Key -> DavLocation
|
||||
keyLocation k = keyDir k ++ keyFile k
|
||||
|
||||
exportLocation :: ExportLocation -> DavLocation
|
||||
exportLocation = fromExportLocation
|
||||
{- Paths containing # or ? cannot be represented in an url, so fails on
|
||||
- those. -}
|
||||
exportLocation :: ExportLocation -> Either String DavLocation
|
||||
exportLocation l =
|
||||
let p = fromExportLocation l
|
||||
in if any (`elem` p) ['#', '?']
|
||||
then Left ("Cannot store file containing '#' or '?' on webdav: " ++ p)
|
||||
else Right p
|
||||
|
||||
{- Where we store temporary data for a key as it's being uploaded. -}
|
||||
keyTmpLocation :: Key -> DavLocation
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue