Skip to content

Compression/Decompression and custom Path #2

@clementh59

Description

@clementh59

Hi Mark,

I've tried to compress and decompress a Digital Link URI with a custom path and I had a problem.

Here is what I'm doing :

const input = 'https://example.com/some/other/path/info/01/09780345418913/21/12345';
const compress = Utils.compressWebUri(input);
const uncompress = Utils.decompressWebUri(compress);
expect(input).to.equal(uncompress);

But uncompress equals https://example.com/01/09780345418913/21/12345

Here are my compress and decompress functions :

const decompressWebUri = (uri, useShortText = false) =>
  toolkit.decompressGS1DigitalLink(uri, useShortText, getUriStem(uri));

const compressWebUri = (uri, useOptimisations = true, compressOtherKeyValuePairs = true) => {
  const uncompressedPrimary = false;
  const useShortText = false;

  return toolkit.compressGS1DigitalLink(
    uri,
    useShortText, // Not used
    getUriStem(uri),
    uncompressedPrimary, // Not used
    useOptimisations,
    compressOtherKeyValuePairs,
  );
};

Do you know where the issue comes from?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions