Skip to content
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

Save only the relative path of the filename in storeFileWithOptions #1989

Open
amitaibu opened this issue Jul 13, 2024 · 1 comment · May be fixed by #1990
Open

Save only the relative path of the filename in storeFileWithOptions #1989

amitaibu opened this issue Jul 13, 2024 · 1 comment · May be fixed by #1990

Comments

@amitaibu
Copy link
Collaborator

amitaibu commented Jul 13, 2024

Right now, on StaticDirStorage we save the filename with the full file path https://example.com/static/image/foo.jpg

StaticDirStorage -> do
let destPath :: Text = "static/" <> objectPath
Directory.createDirectoryIfMissing True (cs $ "static/" <> directory)
fileInfo
|> (.fileContent)
|> LBS.writeFile (cs destPath)
let frameworkConfig = ?context.frameworkConfig
pure $ frameworkConfig.baseUrl <> "/" <> objectPath

I think it's better to save it as /image/foo.jpg; it takes less space and is more flexible if the base path is changed.

@mpscholten
Copy link
Member

Agree. I think it was done to be consistent with the S3 storage method (as that also generates a full absolute url). But I see the point in changing that, so in case it's not breaking anything let's do this 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants