@@ -65,15 +65,15 @@ func ExtractAPIKey(db database.Store, oauth *OAuth2Configs) func(http.Handler) h
6565 }
6666 if cookieValue == "" {
6767 httpapi .Write (rw , http .StatusUnauthorized , httpapi.Response {
68- Message : fmt .Sprintf ("Cookie %q or query parameter must be provided" , SessionTokenKey ),
68+ Message : fmt .Sprintf ("Cookie %q or query parameter must be provided. " , SessionTokenKey ),
6969 })
7070 return
7171 }
7272 parts := strings .Split (cookieValue , "-" )
7373 // APIKeys are formatted: ID-SECRET
7474 if len (parts ) != 2 {
7575 httpapi .Write (rw , http .StatusUnauthorized , httpapi.Response {
76- Message : fmt .Sprintf ("Invalid %q cookie API key format" , SessionTokenKey ),
76+ Message : fmt .Sprintf ("Invalid %q cookie API key format. " , SessionTokenKey ),
7777 })
7878 return
7979 }
@@ -82,26 +82,26 @@ func ExtractAPIKey(db database.Store, oauth *OAuth2Configs) func(http.Handler) h
8282 // Ensuring key lengths are valid.
8383 if len (keyID ) != 10 {
8484 httpapi .Write (rw , http .StatusUnauthorized , httpapi.Response {
85- Message : fmt .Sprintf ("Invalid %q cookie API key id" , SessionTokenKey ),
85+ Message : fmt .Sprintf ("Invalid %q cookie API key id. " , SessionTokenKey ),
8686 })
8787 return
8888 }
8989 if len (keySecret ) != 22 {
9090 httpapi .Write (rw , http .StatusUnauthorized , httpapi.Response {
91- Message : fmt .Sprintf ("Invalid %q cookie API key secret" , SessionTokenKey ),
91+ Message : fmt .Sprintf ("Invalid %q cookie API key secret. " , SessionTokenKey ),
9292 })
9393 return
9494 }
9595 key , err := db .GetAPIKeyByID (r .Context (), keyID )
9696 if err != nil {
9797 if errors .Is (err , sql .ErrNoRows ) {
9898 httpapi .Write (rw , http .StatusUnauthorized , httpapi.Response {
99- Message : "API key is invalid" ,
99+ Message : "API key is invalid. " ,
100100 })
101101 return
102102 }
103103 httpapi .Write (rw , http .StatusInternalServerError , httpapi.Response {
104- Message : "Internal error fetching API key by id" ,
104+ Message : "Internal error fetching API key by id. " ,
105105 Detail : err .Error (),
106106 })
107107 return
@@ -111,7 +111,7 @@ func ExtractAPIKey(db database.Store, oauth *OAuth2Configs) func(http.Handler) h
111111 // Checking to see if the secret is valid.
112112 if subtle .ConstantTimeCompare (key .HashedSecret , hashed [:]) != 1 {
113113 httpapi .Write (rw , http .StatusUnauthorized , httpapi.Response {
114- Message : "API key secret is invalid" ,
114+ Message : "API key secret is invalid. " ,
115115 })
116116 return
117117 }
@@ -128,7 +128,7 @@ func ExtractAPIKey(db database.Store, oauth *OAuth2Configs) func(http.Handler) h
128128 oauthConfig = oauth .Github
129129 default :
130130 httpapi .Write (rw , http .StatusInternalServerError , httpapi.Response {
131- Message : fmt .Sprintf ("Unexpected authentication type %q" , key .LoginType ),
131+ Message : fmt .Sprintf ("Unexpected authentication type %q. " , key .LoginType ),
132132 })
133133 return
134134 }
@@ -140,7 +140,7 @@ func ExtractAPIKey(db database.Store, oauth *OAuth2Configs) func(http.Handler) h
140140 }).Token ()
141141 if err != nil {
142142 httpapi .Write (rw , http .StatusUnauthorized , httpapi.Response {
143- Message : "Could not refresh expired Oauth token" ,
143+ Message : "Could not refresh expired Oauth token. " ,
144144 Detail : err .Error (),
145145 })
146146 return
@@ -156,7 +156,7 @@ func ExtractAPIKey(db database.Store, oauth *OAuth2Configs) func(http.Handler) h
156156 // Checking if the key is expired.
157157 if key .ExpiresAt .Before (now ) {
158158 httpapi .Write (rw , http .StatusUnauthorized , httpapi.Response {
159- Message : fmt .Sprintf ("API key expired at %q" , key .ExpiresAt .String ()),
159+ Message : fmt .Sprintf ("API key expired at %q. " , key .ExpiresAt .String ()),
160160 })
161161 return
162162 }
@@ -184,7 +184,7 @@ func ExtractAPIKey(db database.Store, oauth *OAuth2Configs) func(http.Handler) h
184184 })
185185 if err != nil {
186186 httpapi .Write (rw , http .StatusInternalServerError , httpapi.Response {
187- Message : fmt .Sprintf ("API key couldn't update: %s" , err .Error ()),
187+ Message : fmt .Sprintf ("API key couldn't update: %s. " , err .Error ()),
188188 })
189189 return
190190 }
@@ -196,7 +196,7 @@ func ExtractAPIKey(db database.Store, oauth *OAuth2Configs) func(http.Handler) h
196196 roles , err := db .GetAuthorizationUserRoles (r .Context (), key .UserID )
197197 if err != nil {
198198 httpapi .Write (rw , http .StatusUnauthorized , httpapi.Response {
199- Message : "Internal error fetching user's roles" ,
199+ Message : "Internal error fetching user's roles. " ,
200200 Detail : err .Error (),
201201 })
202202 return
0 commit comments