From 03d39102ba55cda7cbe80fcdeb9b250caaa70bd0 Mon Sep 17 00:00:00 2001 From: pacien Date: Mon, 6 Jan 2020 10:28:27 +0100 Subject: compiler: properly reject invalid dates in sidecar files GitHub: closes #31 --- compiler/src/Resource.hs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'compiler/src/Resource.hs') diff --git a/compiler/src/Resource.hs b/compiler/src/Resource.hs index 207239f..53d61ac 100644 --- a/compiler/src/Resource.hs +++ b/compiler/src/Resource.hs @@ -31,7 +31,6 @@ import Data.Maybe (mapMaybe, fromMaybe) import Data.Function ((&)) import qualified Data.Set as Set import Data.Time.LocalTime (ZonedTime, utc, utcToZonedTime, zonedTimeToUTC) -import Data.Time.Format.ISO8601 (iso8601ParseM) import System.Directory (getModificationTime) import Safe.Foldable (maximumByMay) @@ -110,7 +109,7 @@ buildGalleryTree processItem processThumbnail tagsFromDirectories galleryName in fileModTime <- lastModTime path return GalleryItem { title = itemTitle - , date = fromMaybe fileModTime itemDate + , date = fromMaybe fileModTime $ Input.date sidecar , description = optMeta description "" , tags = (optMeta tags []) ++ implicitParentTags parents , path = parents >= iso8601ParseM - optMeta :: (Sidecar -> Maybe a) -> a -> a optMeta get fallback = fromMaybe fallback $ get sidecar -- cgit v1.2.3