question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Current upload does not support inclusion of mime-type

See original GitHub issue

Our current upload/update methods do not include the mime-type. As such, when we upload photos to storage and download them again they don’t render properly.

The current fix was proposed by John on the discord channel. We should integrate it in so that Users can download/use photos.

    multipart_data = MultipartEncoder(
        fields={
            "file": (
                "party-parrot.gif",
                open("./out/party-parrot.gif", 'rb'),
                "image/gif"
            )
        })

    formHeaders = {
        "Content-Type": multipart_data.content_type,
    }

    headers = dict(supabase._get_auth_headers(), **formHeaders)
    response = requests.post(
        url=request_url,
        headers=headers,
        data=multipart_data,
    )

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
J0commented, Oct 14, 2021

Hey @julianolf,

The tests are commented out because the current test instance does not have the test bucket and will fail upon execution. Unfortunately I don’t have access to the last bucket so we need to swap out the credentials(That’s on me). Feel free to go ahead and write your own tests or just do a manual test with an instance of your own.

I will update the credentials within the next 24h

0reactions
J0commented, Oct 30, 2021

Yup @julianolf,

We are closing for now but feel free to let us know if you still face any further issues.

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Upload MIME type restriction (instance security hardening)
(Medium) To reduce vulnerabilities such as file inclusion and malicious file uploads, MIME type verification should be enabled. References ...
Read more >
MIME types (IANA media types) - HTTP - MDN Web Docs
A MIME type most-commonly consists of just two parts: a type and a subtype, separated by a slash ( / ) — with...
Read more >
422 error when file extension does not match mime type - Drupal
Problem/Motivation When uploading a file where the extension doesn't match the detected mime type, a 422 error is returned.
Read more >
ColdFusion 10 CFFILE Accept mimetype not recognised
The issue is, as the error states, that the mime type of the uploaded file is "application/octet-stream" not "video/x-ms-wmv". I tried to point...
Read more >
Manual:MIME type detection - MediaWiki
MediaWiki tries to detect the MIME type of the files you upload, and rejects the file if the file-extension does not match the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found