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

fix: Unable to shorten URL #696

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

morganney
Copy link

@morganney morganney commented Sep 3, 2021

Replaces jsonpack with lz-string to help address #134.

Corresponding bundlewatch PR is bundlewatch/bundlewatch#436.

@morganney morganney changed the title Replace jsonpack with lz-string fix: Unable to shorten URL Sep 3, 2021
@morganney
Copy link
Author

Tests passed but got this coveralls issue.

@@ -143,7 +143,14 @@ function createServerlessApp() {
'/results',
asyncMiddleware(async (req, res) => {
let { d } = req.query
const unpacked = jsonpack.unpack(d)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we would like to keep both implementations here in order to fallback to jsonpack if the data isn't compressed so that older links are still accessible, right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would probably be ideal, yes. I'll have to find some time to get back to this but some possibilities might be:

  • Try to detect if the data has been compressed with lz-string in the handler here, although I don't see provided function from lz-string to do this.
  • Create a new major version with this breaking change.
  • Add a new request param in the CLI/Node app here that indicates compression with lz-string, then check for the presence of that request param in this handler.

My preference would be for the last option.

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

Successfully merging this pull request may close these issues.

None yet

2 participants