Skip to content

Commit

Permalink
Adapt createTemporaryDownloadUrlFromPathWithExpiredAt
Browse files Browse the repository at this point in the history
  • Loading branch information
amitaibu committed Oct 5, 2024
1 parent b13c798 commit 6e0db34
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion IHP/FileStorage/ControllerFunctions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,13 @@ createTemporaryDownloadUrlFromPathWithExpiredAt validInSeconds objectPath = do
case storage of
StaticDirStorage -> do
let frameworkConfig = ?context.frameworkConfig
let url = frameworkConfig.baseUrl <> "/" <> objectPath
let urlSchemes = ["http://", "https://"]

let url = if any (`isPrefixOf` objectPath) urlSchemes
-- BC, before we saved only the relative path of a file, we saved the full URL. So use it as is.
then objectPath
-- We have the relative path, so add the baseUrl.
else frameworkConfig.baseUrl <> objectPath

pure TemporaryDownloadUrl { url = cs url, expiredAt = publicUrlExpiredAt }
S3Storage { connectInfo, bucket} -> do
Expand Down

0 comments on commit 6e0db34

Please sign in to comment.