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

VCard::addMedia() 'Content-Type' validation should be case insensitive #194

Open
dGilli opened this issue Jan 26, 2022 · 2 comments
Open

Comments

@dGilli
Copy link

dGilli commented Jan 26, 2022

if (array_key_exists('Content-Type', $headers)) {
    $mimeType = $headers['Content-Type'];
    ...
}

In VCard::addMedia() on line 239 and 240, the 'Content-Type' lookup should be case insensitive.

Header content-type: image/jpeg will throw unexpected error.

@Satvik-web
Copy link

Hey @dGilli!
Greetings from. India, TamilNadu!

If you are trying to create a VCard.. Then you are in the right place! I have created a nuget package with helps you to achieve it.. I have given the implementation in GitHub readme.md file..
You can install it using the following command using the package manager console..

PM> Install-Package VCard -Version 1.0.0

Nuget link: https://www.nuget.org/packages/VCard/

Github Link : https://github.com/Satvik-web/VCard

@Dathix
Copy link

Dathix commented Jan 20, 2023

I had exactly the same problem. I think adding array_change_key_case() would be ideal.
After that, every header can be accessed using its lowercase name. I opened PR #210.

$headers = array_change_key_case(get_headers($url, 1));

if (array_key_exists('content-type', $headers)) {
    $mimeType = $headers['content-type'];
    if (is_array($mimeType)) {
        $mimeType = end($mimeType);
    }
}

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