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

Escaped colons are improperly parsed #16

Open
ultimate-tester opened this issue Dec 11, 2017 · 2 comments
Open

Escaped colons are improperly parsed #16

ultimate-tester opened this issue Dec 11, 2017 · 2 comments

Comments

@ultimate-tester
Copy link

Google gives back a URL like so:

'URL:https\\://plus.google.com/u/0/38497128973128932',

The colon has been escaped with a double backslash. Once it has been parsed, the output is simply:

https\

This means that the colon was not escaped at all.

If you are willing to accept, a pull request can be made to fix this.

@callaginn
Copy link

callaginn commented May 8, 2020

I've noticed a similar issue with vcard photos.

How to Reproduce

INPUT: PHOTO:https://example.com/photo.jpg
OUTPUT: https

Possible Workarounds

You can work around this two different ways:

A) Remove the colon and text before it:

INPUT: PHOTO://example.com/photo.jpg
OUTPUT: //example.com/photo.jpg

B) Add MEDIATYPE information:

INPUT: PHOTO;MEDIATYPE=image/jpeg:https://example.com/photo.jpg
OUTPUT: PHOTO: { type: [ 'MEDIAimage/jpeg' ], value: '//example.com/photo.jpg' }

@callaginn
Copy link

callaginn commented May 8, 2020

Possible Fix:

In the this.parsevCard() function of blob/master/vcard.js, change this:

var fields = data[f].split(":");

to this:

var fields = data[f].split(/(?<=^[^:]+):/y);

Basically, they were splitting the string on every single colon and returning the second array item. So stuff like URLs got split multiple times. That regex split makes sure it splits only the first colon.

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

2 participants