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

feat(base64-string-converter): switch to encode and decode url safe #392

Merged
merged 5 commits into from
May 15, 2023

Conversation

cgoIT
Copy link
Contributor

@cgoIT cgoIT commented May 7, 2023

fixes #376

@vercel
Copy link

vercel bot commented May 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
it-tools ✅ Ready (Inspect) Visit Preview May 15, 2023 8:24am

Copy link
Owner

@CorentinTh CorentinTh left a comment

Choose a reason for hiding this comment

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

Thanks for the changes 🙏🏻
Really love the new unit tests 💪🏻

Just small request changes

}

function base64ToText(str: string) {
if (!isValidBase64(str)) {
function base64ToText(str: string, urlSafe = false) {
Copy link
Owner

Choose a reason for hiding this comment

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

I'm not really fan of magic boolean positionnal arguments, can you make this argument a config object please ?

Suggested change
function base64ToText(str: string, urlSafe = false) {
function base64ToText(str: string, { makeUrlSafe = false } : { makeUrlSafe?: boolean } = {}) {

@@ -22,12 +26,33 @@ function removePotentialDataAndMimePrefix(str: string) {
return str.replace(/^data:.*?;base64,/, '');
}

function isValidBase64(str: string) {
const cleanStr = removePotentialDataAndMimePrefix(str);
function isValidBase64(str: string, urlSafe = false) {
Copy link
Owner

Choose a reason for hiding this comment

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

Same here

Suggested change
function isValidBase64(str: string, urlSafe = false) {
function isValidBase64(str: string, { decodeUrlSafe = false } : { decodeUrlSafe?: boolean } = {}) {

cgoIT added 2 commits May 15, 2023 06:44
* main:
  refactor(ui): replaced some n-input with c-input-text
  chore(version): release 2023.05.14-77f2efc
  docs(changelog): update changelog for 2023.05.14-77f2efc
  refactor(ui): replaced some n-input with c-input-text
  ui-lib(new-component): added text input component in the c-lib
  ui-lib(button): size variants
  chore(issues): updated new tool request issue template

# Conflicts:
#	src/tools/base64-string-converter/base64-string-converter.vue
…ditional refs for changes which interfere with validation rules
* main:
  fix(ipv4-converter): removed readonly on input
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Owner

@CorentinTh CorentinTh left a comment

Choose a reason for hiding this comment

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

Nice, thanks

@CorentinTh CorentinTh merged commit 0b20f1c into CorentinTh:main May 15, 2023
@cgoIT cgoIT deleted the feat/base64-url-encode-option branch June 14, 2023 04:34
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.

[TOOL IMPROVEMENT] Base64URL encode/decode
2 participants