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

[16.0] fs_attachment: sent the mimetype information for S3 #354

Closed
wants to merge 1 commit into from

Conversation

sebastienbeau
Copy link
Member

@sebastienbeau sebastienbeau commented Mar 15, 2024

When storing image on amazon s3, ovh or scaleway.
The minetype must be set in order to have the right mimetype when requesting the image publicly.

Note : when using the api put_file it will guess the mimetype automatically : https://github.com/fsspec/s3fs/blob/47ffcfad33f8c74974a1515cb266168ede6cf4b5/s3fs/core.py#L1176

@OCA-git-bot
Copy link
Contributor

Hi @lmignon,
some modules you are maintaining are being modified, check this out!

@sebastienbeau sebastienbeau changed the title fs_attachment: sent the mimetype information for S3 [16.0] fs_attachment: sent the mimetype information for S3 Mar 15, 2024
orbeet-io-bot
orbeet-io-bot approved these changes Jun 24, 2024
@vincent-hatakeyama
Copy link
Contributor

Cherry picked in 17.0 to test with a local minio, mimetype is now correctly set.

Comment on lines +387 to +389
if hasattr(fs.fs, "s3"):
# For S3 storage the mimetype should be pass in the kwargs
return {"ContentType": self._context["mimetype"]}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the s3 fs could be nested at a deeper level... IMO you should recursively test the nested fs. Something like:

_fs = fs
while _fs:
    if hasattr(_fs, "s3"):
        return {"ContentType": self._context["mimetype"]}
    _fs = getattr(_fs, "fs", None)

Copy link

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Oct 27, 2024
@lmignon
Copy link
Contributor

lmignon commented Nov 10, 2024

superseded by #378

@lmignon lmignon closed this Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale PR/Issue without recent activity, it'll be soon closed automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants