Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
server
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
m-team
oidc
mytoken
server
Commits
48917ba5
Commit
48917ba5
authored
4 years ago
by
Gabriel Zachmann
Browse files
Options
Downloads
Patches
Plain Diff
refactor empty string comparison
parent
8921c7e9
No related branches found
No related tags found
No related merge requests found
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
shared/supertoken/pkg/stid/stid.go
+2
-2
2 additions, 2 deletions
shared/supertoken/pkg/stid/stid.go
shared/utils/utils.go
+1
-1
1 addition, 1 deletion
shared/utils/utils.go
with
3 additions
and
3 deletions
shared/supertoken/pkg/stid/stid.go
+
2
−
2
View file @
48917ba5
...
...
@@ -28,13 +28,13 @@ func (i *STID) Valid() bool {
}
func
(
i
*
STID
)
HashValid
()
bool
{
if
len
(
i
.
hash
)
>
0
{
if
i
.
hash
!=
""
{
return
true
}
if
i
.
UUID
.
String
()
==
"00000000-0000-0000-0000-000000000000"
{
return
false
}
return
len
(
i
.
Hash
()
)
>
0
return
i
.
Hash
()
!=
""
}
func
(
i
*
STID
)
Hash
()
string
{
...
...
This diff is collapsed.
Click to expand it.
shared/utils/utils.go
+
1
−
1
View file @
48917ba5
...
...
@@ -266,7 +266,7 @@ func IsJWT(token string) bool {
return
false
}
for
i
,
segment
:=
range
arr
{
if
len
(
segment
)
>
0
||
i
<
2
{
// first two segments must not be empty
if
segment
!=
""
||
i
<
2
{
// first two segments must not be empty
if
_
,
err
:=
base64
.
URLEncoding
.
DecodeString
(
arr
[
2
]);
err
!=
nil
{
return
false
}
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment