Skip to content

Improve Implicit service:cid Conversion #2042

@hacdias

Description

@hacdias

In multiple places of our code base, we convert pin information, stored as service:cid, using .split(':'). This can open the way for some bugs (unlikely unless some data is corrupted or manually changed in the user's local storage). We can replace this instances by some method that validates the string and returns the expected output.

// id = `${serviceName}:${cid}`
const cacheId2Cid = (id) => id.split(':').at(-1)
const cacheId2ServiceName = (id) => id.split(':').at(0)

const remotePinsCids = remotePins.map(id => id.split(':').at(-1))

And some others introduced in #1919.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium: Good to have, but can wait until someone steps upexp/intermediatePrior experience is likely helpfulkind/discussionTopical discussion; usually not changes to codebasekind/enhancementA net-new feature or improvement to an existing featurestatus/readyReady to be workedtopic/design-contentContent design, writing, information architecture

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions