A container registry that uses the AT Protocol for manifest storage and S3 for blob storage. atcr.io
docker container atproto go
81
fork

Configure Feed

Select the types of activity you want to include in your feed.

more lint cleanup

+27 -10
-3
.golangci.yml
··· 26 26 - errcheck 27 27 28 28 # TODO: fix issues and remove these paths one by one 29 - - path: cmd/credential-helper 30 - linters: 31 - - errcheck 32 29 33 30 formatters: 34 31 enable:
+12 -3
pkg/appview/handlers/device.go
··· 362 362 } 363 363 364 364 w.Header().Set("Content-Type", "text/html; charset=utf-8") 365 - tmpl.Execute(w, data) 365 + if err := tmpl.Execute(w, data); err != nil { 366 + http.Error(w, "failed to render template", http.StatusInternalServerError) 367 + return 368 + } 366 369 } 367 370 368 371 func (h *DeviceApprovalPageHandler) renderSuccess(w http.ResponseWriter, deviceName string) { ··· 374 377 } 375 378 376 379 w.Header().Set("Content-Type", "text/html; charset=utf-8") 377 - tmpl.Execute(w, data) 380 + if err := tmpl.Execute(w, data); err != nil { 381 + http.Error(w, "failed to render template", http.StatusInternalServerError) 382 + return 383 + } 378 384 } 379 385 380 386 func (h *DeviceApprovalPageHandler) renderError(w http.ResponseWriter, message string) { ··· 387 393 388 394 w.Header().Set("Content-Type", "text/html; charset=utf-8") 389 395 w.WriteHeader(http.StatusBadRequest) 390 - tmpl.Execute(w, data) 396 + if err := tmpl.Execute(w, data); err != nil { 397 + http.Error(w, "failed to render template", http.StatusInternalServerError) 398 + return 399 + } 391 400 } 392 401 393 402 func getClientIP(r *http.Request) string {
+8 -2
pkg/appview/jetstream/worker.go
··· 132 132 }) 133 133 134 134 // Set initial read deadline 135 - conn.SetReadDeadline(time.Now().Add(90 * time.Second)) 135 + if err := conn.SetReadDeadline(time.Now().Add(90 * time.Second)); err != nil { 136 + return fmt.Errorf("failed to set read deadline: %w", err) 137 + } 136 138 137 139 // Create zstd decoder for decompressing messages 138 140 decoder, err := zstd.NewReader(nil) ··· 178 180 } 179 181 180 182 // Send ping with write deadline 181 - conn.SetWriteDeadline(time.Now().Add(10 * time.Second)) 183 + if err := conn.SetWriteDeadline(time.Now().Add(10 * time.Second)); err != nil { 184 + slog.Warn("Jetstream failed to set write deadline", "error", err) 185 + conn.Close() 186 + return 187 + } 182 188 if err := conn.WriteMessage(websocket.PingMessage, nil); err != nil { 183 189 slog.Warn("Jetstream failed to send ping", "error", err) 184 190 conn.Close()
+3 -1
pkg/appview/middleware/registry.go
··· 204 204 205 205 func init() { 206 206 // Register the name resolution middleware 207 - registrymw.Register("atproto-resolver", initATProtoResolver) 207 + if err := registrymw.Register("atproto-resolver", initATProtoResolver); err != nil { 208 + panic("failed to register atproto-resolver middleware: " + err.Error()) 209 + } 208 210 } 209 211 210 212 // NamespaceResolver wraps a namespace and resolves names
+4 -1
pkg/appview/storage/proxy_blob_store.go
··· 8 8 "io" 9 9 "log/slog" 10 10 "net/http" 11 + "strconv" 11 12 "sync" 12 13 "time" 13 14 ··· 170 171 // Return a minimal descriptor with size from Content-Length if available 171 172 size := int64(0) 172 173 if contentLength := resp.Header.Get("Content-Length"); contentLength != "" { 173 - fmt.Sscanf(contentLength, "%d", &size) 174 + if parsed, err := strconv.ParseInt(contentLength, 10, 64); err == nil { 175 + size = parsed 176 + } 174 177 } 175 178 176 179 return distribution.Descriptor{