ringcentral / ringcentral-c2d

RingCentral Click To Dial library
https://ringcentral.github.io/ringcentral-c2d/
5 stars 5 forks source link

c2d extension for Chrome wrap numbers into response from server #2

Closed yuriti89 closed 5 years ago

yuriti89 commented 5 years ago

Hi!

I have an issue with c2d extension for Chrome (https://chrome.google.com/webstore/detail/ringcentral-for-google/fddhonoimfhgiopglkiokmofecgdiedb?hl=en).

When server response (for ajax request) contains string with numbers that looks like phones they're wrapped by <rc-c2d-number> tag.

For example, response payload is START~OK:1~{"original":{"url":"/images/15578411/1008024901.jpg","width":3600,"height":2400,"size":5619361}NEW_LINE~END~. And it transforms to START~OK:1~{"original":{"url":"/images/15578411<rc-c2d-number data-rc-number="/1008024901">/1008024901</rc-c2d-number>.jpg","width":3600,"height":2400,"size":5619361}NEW_LINE~END~ on client side and cannot be parsed.

My point is that extension should not change server responses.

embbnux commented 5 years ago

Hi, @yuriti89 Thanks for feedback. Do you put your response in HTML? In our C2D solution, we only will observe HTML text for Click To Dial. And do you have any test page that we can test?

yuriti89 commented 5 years ago

Yes, response has content-type "text/html". Is it enough to change type to "text/plain"?

u9520107 commented 5 years ago

Let me rephrase my lengthy mumbling... ==edited==

@yuriti89 What this lib was designed to do is to scrape for phone-number-like strings in webpages. More specifically anything in the <body> tag. By the looks of it, you are viewing your server response as a web page. Which by design, this lib will scrape for phone numbers.

I am not 100% sure, but I suspect changing the content-type in this case will not matter. Chrome tends to wrap plain text in <body> to render as web page anyway.

Please rest assured that this library will not actually tap into http requests, it will only scrape things as they are rendered into the dom structure.

If you want to view server responses as webpage without being tempered, the only option imo is to disable this c2d.

It also appears that you are using our official Chrome extension. Currently the only workaround would be to temporarily disable this feature in settings, where there is a checkbox to control c2d/c2sms injection.

yuriti89 commented 5 years ago

You can test current behavior by following steps: 1) create new store at https://my.ecwid.com/ (it's free); 2) go to Catalog -> Products -> Add New Product; 3) upload image.

In network console in Chrome there will be POST request to https://my.ecwid.com/uploadImages. Its response contains digits that may looks like phone numbers and these numbers may be wrapped by <rc-c2d-number>.

u9520107 commented 5 years ago

Please check the screenshots, we do not temper with network responses. We only scrap numbers that is in the DOM structure. Please take some screenshots so we get a better idea of what went wrong.

image image

yuriti89 commented 5 years ago

Hmm. It's our merchant report that images uploading not working. By logs I investigated that numbers in responses wrapped by tag. I can't check it by myself because can not create trial at ringcentral.com so can not use Chrome extension.

u9520107 commented 5 years ago

I see. I think there are 2 things you can do:

  1. Recommend your customer to temporarily disable the C2D feature on their chrome extension as a workaround when they need to upload.
  2. Recommend your customer to contact RingCentral support. Most likely this support case will be routed back to us. Our support should be able to aid the customer to properly collect logs for investigation.
yuriti89 commented 5 years ago

Ok, thanks for help!