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

Shortens encoded deeplink URL parameter value #1444

Merged
merged 4 commits into from
Jul 17, 2024
Merged

Conversation

sabieber
Copy link
Member

@sabieber sabieber commented Jul 16, 2024

Description

... by not mixing up integer char representations between 8 and 16 bit

This mixup lead to our deeplinks being two times as long as necessary while containing the same information.
As we used inverse logic for encoding and decoding this did not lead to any problems.

Deeplinks in the old format are still correctly read and "converted".

Before:

http://localhost:9000/p/SBI-H-INTERN?oxDeeplink=ewAiAHUAbgBpAHYAZQByAHMAYQBsAFMAZQBhAHIAYwBoAHwAMgAiADoAewAiAHYAaQBlAHcAIgA6ACIAZgBpAGwAdABlAHIAZQBkACIALAAiAGYAaQBsAHQAZQByAHMAIgA6AHsAIgBiAHIAYQBuAGQAIgA6AFsAIgBWAE8ANQAxADMAMwBJAEcARgBLADAARQA1AFMAVAAzAEkARgA5AEUASQBQADgARwBOADAAIgBdAH0ALAAiAHEAdQBlAHIAeQAiADoAIgBtAGEAcgBzACIALAAiAGgAaQBkAGQAZQBuAEYAaQBsAHQAZQByAHMAIgA6AHsAfQB9ACwAIgBvAHYAZQByAGwAYQB5ACIAOgB7ACIAdAB5AHAAZQAiADoAIgBvAHAAZQBuAFAAcgBvAGQAdQBjAHQARABhAHQAYQBzAGgAZQBlAHQAIgAsACIAYQByAGcAcwAiADoAewAiAHQAYQByAGcAZQB0ACIAOgAiAC4AcwBjAGkALQBvAHYAZQByAGwAYQB5ACAALgBvAHgAbwBtAGkALQBwAHIAbwBkAHUAYwB0AC0AZABhAHQAYQBzAGgAZQBlAHQALQBjAG8AbgB0AGEAaQBuAGUAcgAiACwAIgBzAHUAcABwAGwAaQBlAHIATgB1AG0AYgBlAHIAIgA6ACIAUwBCAEkAIgAsACIAaQB0AGUAbQBOAHUAbQBiAGUAcgAiADoAIgBNA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kZW5GaWx0ZXJzIjp7fX0sIm92ZXJsYXkiOnsidHlwZSI6Im9wZW5Qcm9kdWN0RGF0YXNoZWV0IiwiYXJncyI6eyJ0YXJnZXQiOiIuc2NpLW92ZXJsYXkgLm94b21pLXByb2R1Y3QtZGF0YXNoZWV0LWNvbnRhaW5lciIsInN1cHBsaWVyTnVtYmVyIjoiU0JJIiwiaXRlbU51bWJlciI6Ik1BUlMiLCJwcm9kdWN0SWQiOiI3TTRDQ1E2MUtGSjBIUUxDMU9BMUo1OFVQUyIsInRleHRPcmlnaW5hbCI6IkFiYmlsZHVuZyDkaG5saWNoIiwidGV4dFN1YnN0aXR1dGUiOiJBYmJpbGR1bmcgd2VpY2h0IGFiIn19fQ==

--> Base64 decoded:

{"universalSearch|2":{"view":"filtered","filters":{"brand":["VO5133IGFK0E5ST3IF9EIP8GN0"]},"query":"mars","hiddenFilters":{}},"overlay":{"type":"openProductDatasheet","args":{"target":".sci-overlay .oxomi-product-datasheet-container","supplierNumber":"SBI","itemNumber":"MARS","productId":"7M4CCQ61KFJ0HQLC1OA1J58UPS","textOriginal":"Abbildung �hnlich","textSubstitute":"Abbildung weicht ab"}}}

Additional Notes

  • This PR fixes or works on following ticket(s): SIRI-987

Checklist

  • Code change has been tested and works locally
  • Code was formatted via IntelliJ and follows SonarLint & best practices
  • Patch Tasks: Is local execution of Patch Tasks necessary? If so, please also mark the PR with the tag.

sabieber added 2 commits July 16, 2024 15:28
... by not mixing up integer char representations between 8 and 16 bit

This mixup lead to our deeplinks being two times as long as necessary while containing the same information.
As we used inverse logic for encoding and decoding this did not lead to any problems.

Fixes: SIRI-987
@sabieber sabieber added 🧬 Enhancement Contains new features 👶🏻 Trivial Easy to review labels Jul 16, 2024
@sabieber sabieber added the 🖐 Keep open Should not be merged label Jul 16, 2024
@idlira idlira removed the 🖐 Keep open Should not be merged label Jul 16, 2024
sabieber added 2 commits July 17, 2024 11:31
After some feedback and local testing the encoding/decoding logic can be further simplified and still encodes and decodes the JSON state string correctly and reliably.

Fixes: SIRI-987
@sabieber sabieber requested a review from idlira July 17, 2024 09:32
@sabieber sabieber merged commit 970fd64 into develop Jul 17, 2024
3 checks passed
@sabieber sabieber deleted the feature/sbi/SIRI-987 branch July 17, 2024 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧬 Enhancement Contains new features 👶🏻 Trivial Easy to review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants