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

AddMedia - fails for if to allow_url_fopen is 0 due to mimetype inspection #213

Open
PaulW187 opened this issue Apr 24, 2023 · 2 comments
Open

Comments

@PaulW187
Copy link

IN ALLOW_URL_FOPEN IS FALSE, THERE IS PRABLEM WITH GET MIM TYPE BECAUSE GET_HEADERS NOT ALLOWED.

FOLLOWING IS PATCH FOR TO WORK IT WITH CURL )))))

ADD IN VCARD.PHP LINE 234:

if ((bool) ini_get('allow_url_fopen') === true) { 
                    $headers = get_headers($url, 1);

                    if (array_key_exists('Content-Type', $headers)) {
                        $mimeType = $headers['Content-Type'];
                        if (is_array($mimeType)) {
                            $mimeType = end($mimeType);
                        }
                    }
} else {
                   $curl = curl_init();
                        curl_setopt_array( $curl, array(
                            CURLOPT_HEADER => true,
                            CURLOPT_NOBODY => true,
                            CURLOPT_RETURNTRANSFER => true,
                            CURLOPT_URL => $url ) );
                        $mimeType= curl_getinfo($curl, CURLINFO_CONTENT_TYPE);
                    curl_close( $curl );
          

 }

GREETZ PAUL 187 (SORRY FOR BAD ENGLISH I AM 🥚 BROTHER)

@jeroendesloovere
Copy link
Owner

Hi paul, great for the help.
Would you be able to create a merge request for it (eventually an additional unit test if possible)

@dgillier
Copy link

dgillier commented May 7, 2023

Hello,
Got same error (with a picture store using cloudfront).

Any update soon ?

Thanks, denis

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

No branches or pull requests

3 participants