More aggressively normalise fileTitles

This commit is contained in:
Gregor Kleen 2018-07-01 15:02:15 +02:00
parent 0d01ac95ab
commit 957f0fe9da
2 changed files with 6 additions and 3 deletions

View File

@ -242,8 +242,11 @@ submissionHelper tid csh shn (SubmissionMode mcid) = do
let colonnadeFiles :: _ -> Colonnade Sortable _ (DBCell (WidgetT UniWorX IO) ())
colonnadeFiles cid = mconcat
-- [ sortable (Just "type") "Typ" $ \(_,_, E.Value ftype) -> textCell $ toPathPiece ftype
[ sortable (Just "path") "Dateiname" $ anchorCell (\(Entity _ SubmissionFile{..}, Entity _ File{..}) -> CSubmissionR tid csh shn cid $ SubDownloadR (isUpdateSubmissionFileType submissionFileIsUpdate) fileTitle)
(\(_, Entity _ File{..}) -> str2widget fileTitle)
[ sortable (Just "path") "Dateiname" $ \input@(_, Entity _ File{..}) -> case isNothing fileContent of
False -> anchorCell (\(Entity _ SubmissionFile{..}, Entity _ File{..}) -> CSubmissionR tid csh shn cid $ SubDownloadR (isUpdateSubmissionFileType submissionFileIsUpdate) fileTitle)
(\(_, Entity _ File{..}) -> str2widget fileTitle)
input
True -> textCell $ addTrailingPathSeparator fileTitle
, sortable (Just "time") "Modifikation" $ \(_, Entity _ File{..}) -> stringCell $ formatTimeGerWDT fileModified
]
smid2ArchiveTable (smid,cid) = DBTable

View File

@ -56,7 +56,7 @@ consumeZip = unZipStream `fuseUpstream` consumeZip'
Just (Left ZipEntry{..}) -> do
contentChunks <- toConsumer accContents
let
fileTitle = normalise $ makeValid zipEntryName
fileTitle = dropWhile isPathSeparator . dropTrailingPathSeparator . normalise $ makeValid zipEntryName
fileModified = localTimeToUTC utc zipEntryTime
fileContent
| hasTrailingPathSeparator zipEntryName = Nothing