Giter Site home page Giter Site logo

Comments (14)

bobjflong avatar bobjflong commented on June 12, 2024

Hi @liorhar,

We escape identity attributes like name on output in the API, but it looks like we weren't unescaping HTML input on the /companies endpoint. We are doing this now so this issue shouldn't compound itself. Will you be able to fix up your data? Perhaps by searching for companies with HTML entities in their name?

from intercom-java.

liorhar avatar liorhar commented on June 12, 2024

I'm not sure I understand your response. Are you saying that the read endpoint will now return the company name escaped, so when I update the company it should all just work?
My data is sanitized, I never send HTML elements in the name

from intercom-java.

liorhar avatar liorhar commented on June 12, 2024

@bobjflong

from intercom-java.

bobjflong avatar bobjflong commented on June 12, 2024

We escape name in the API, so if your company name was Foo & Bar, it would be rendered as Foo & Bar in the API response.

So if you read that name in the intercom-java client, and submitted an update, it would be stored as Foo & Bar, and then re-rendered as Foo & Bar.

Now, after the bug fix if you submit Foo & Bar, it will stay stored as Foo & Bar, and be rendered as Foo & Bar. Does that make sense?

from intercom-java.

liorhar avatar liorhar commented on June 12, 2024

Yes, it does.
So is the bug fixed already on your end?
Do I have to encode the name before updating the company using the java client or does it do it automatically?

from intercom-java.

bobjflong avatar bobjflong commented on June 12, 2024

The bug is fixed on our end. You can either submit Foo & Bar or Foo & Bar and it will be stored as Foo & Barin the datastore.

from intercom-java.

liorhar avatar liorhar commented on June 12, 2024

I'm sorry but I'm still getting the following error when updating companies with special characters:
updating Banes & Spot, message: custom_attributes invalid, length too long: name

from intercom-java.

bobjflong avatar bobjflong commented on June 12, 2024

Is it possible that you have a really long custom attribute called name? Could you print out the Company object you are trying to save?

from intercom-java.

liorhar avatar liorhar commented on June 12, 2024

It is possible, see the screenshot attached to the issue. But that's only because your endpoint has expanded a single ampersand into dozens of them.
I set the new name which is short Banes & Spot yet it fails to update probably cause of the previous value.

from intercom-java.

bobjflong avatar bobjflong commented on June 12, 2024

But that's a custom_attribute? custom_attributes are key/value pairs that you can set arbitrarily. Are you using that alongside a normal name field?

from intercom-java.

liorhar avatar liorhar commented on June 12, 2024

yes, I'm using custom attributes but those are either boolean or numeric so their value can't be long. This is the code snippet:

company.setName(companyStats.name)
        company.addCustomAttribute(CustomAttribute.newBooleanAttribute("hasDemoData", companyStats.hasDemoData))
        company.addCustomAttribute(CustomAttribute.newIntegerAttribute("filledFinancialInfo", companyStats.hasSignificantData))
        company.addCustomAttribute(CustomAttribute.newIntegerAttribute("employees", companyStats.numberOfEmployees))
        company.addCustomAttribute(CustomAttribute.newIntegerAttribute("size", companyStats.size))
        company.addCustomAttribute(CustomAttribute.newDoubleAttribute("averageAge", companyStats.averageAge))
        company.setRemoteCreatedAt(companyStats.createdAt.atZone(ZoneOffset.UTC).toEpochSecond)
        if (companyStats.numberOfDaysLeftToTrial.isDefined) company.addCustomAttribute(CustomAttribute.newIntegerAttribute("numberOfDaysLeftToTrial", companyStats.numberOfDaysLeftToTrial.get))
        Company.update(company)
        ```

from intercom-java.

bobjflong avatar bobjflong commented on June 12, 2024

OK - could you give me some information to track down the failing request. Do you have an app_id, or better yet a request_id from the failed call?

from intercom-java.

liorhar avatar liorhar commented on June 12, 2024

can we move this discussion to a private channel?

from intercom-java.

bobjflong avatar bobjflong commented on June 12, 2024

Yep, feel free to get in touch through the Intercom widget (ask for bob)

from intercom-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.