Skip to content

storagePrefix for S3 should return the base URL #2070

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions IHP/FileStorage/ControllerFunctions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,14 @@ storeFileFromPath path options = do
let fileContentType = Mime.defaultMimeLookup (cs path)

fileContent <- LBS.readFile (cs path)

-- If fileName was passed (as UUID), use it. Otherwise, keep it empty, and a new random UUID will be generated.
let fileName = case options.fileName of
Just name -> cs $ UUID.toText name
Nothing -> ""

let file = Wai.FileInfo
{ fileName = ""
{ fileName = fileName
, fileContentType
, fileContent
}
Expand Down Expand Up @@ -420,4 +426,4 @@ storage = ?context.frameworkConfig.appConfig
storagePrefix :: (?context :: ControllerContext) => Text
storagePrefix = case storage of
StaticDirStorage { directory } -> directory
_ -> ""
S3Storage { baseUrl} -> baseUrl