Use base64.RawURLEncoding instead of defining base64Alphabet #1
Labels
No Label
bug
feature
good-beginner-bug
needs-test
question
wontfix
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: electricdusk/rushlink#1
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
In https://gitea.hashru.nl/dsprenkels/rushlink/src/branch/master/handlers.go#L56 we can use
base64.RawURLEncoding
provided in the standard library.E.g. https://gitea.hashru.nl/dsprenkels/rushlink/src/branch/master/handlers.go#L251
I am wondering if this is actually possible. Although we use the base64url alphabet, we do not use the base64 encoding. That is, because our IDs are generated in base 64, not in base 256. (I.e. they are not defined over bytes, but over sextets.)
Reusing
base64.encodeURL
, would be cool, but is obviously impossible.Closing this as wontfix.
In
544c093c35/internal/handlers/handlers.go (L257)
you do a base64 encoding over a slice of bytes, that seem ultimately filled throughgenerateOwnerToken()
in544c093c35/internal/handlers/handlers.go (L373)
, where 16 bytes are sourced fromrand.Read()
.I'm not sure what you mean with
because that is (obviously) not the case.
I now see what you mean. I fixed this; applying this patch:
Note. It seems I misunderstood which base64 encoding was meant, because of the outdated line specifiers. I should just have Ctrl+F'd the code in the snippet.