Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Fix code that didn't even compile

Manav Rathi2196c3dbc8a2
diff --git a/server/pkg/middleware/auth.go b/server/pkg/middleware/auth.go
index 6b1b191b1a..0b8fe5bd05 100644
--- a/server/pkg/middleware/auth.go
+++ b/server/pkg/middleware/auth.go
@@ -94,9 +94,12 @@ func (m *AuthMiddleware) AdminAuthMiddleware() gin.HandlerFunc {
// The config allows alternatively specifying a singular admin ID to
// workaround Viper issues in passing env vars for an int slice.
if len(admins) == 0 {
- if viper.GetInt("internal.admin") == userId {
- c.Next()
- return
+ admin := viper.GetInt("internal.admin")
+ if admin != 0 {
+ if int64(admin) == userID {
+ c.Next()
+ return
+ }
}
}
// if no admins are set, then check if the user is first user in the system